diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 8a264408c6c..3c0002d5cae 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -257,7 +257,9 @@ jobs: if: ${{ inputs.build_pdf }} working-directory: doc shell: bash - run: make pdf + run: | + sudo apt-get install -y inkscape + make pdf - name: "Show latex dir" if: ${{ inputs.build_pdf }} diff --git a/doc/changelog.d/4262.added.md b/doc/changelog.d/4262.added.md new file mode 100644 index 00000000000..e45959b142a --- /dev/null +++ b/doc/changelog.d/4262.added.md @@ -0,0 +1 @@ +\`\`prep7\`\` - part 2 diff --git a/doc/source/conf.py b/doc/source/conf.py index 79dd33206e4..ebf15476028 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -14,10 +14,12 @@ from plotly.io._sg_scraper import plotly_sg_scraper import pyvista from sphinx.application import Sphinx +from sphinx.builders.latex import LaTeXBuilder from sphinx.util import logging from sphinx_gallery.sorting import FileNameSortKey pio.renderers.default = "sphinx_gallery" +LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml"] from ansys.mapdl import core as pymapdl from ansys.mapdl.core import __version__ @@ -130,7 +132,6 @@ } suppress_warnings = ["label.*", "design.fa-build", "config.cache"] -sd_fontawesome_latex = True # Graphviz diagrams configuration graphviz_output_format = "png" @@ -376,10 +377,21 @@ # -- Options for LaTeX output ------------------------------------------------ -latex_elements: dict[Any, Any] = {} +latex_elements: dict[Any, Any] = { + "preamble": r""" +\usepackage[inkscapelatex=false]{svg} +\usepackage{graphicx} + """, + # Enable shell escape for SVG conversion + "extraclassoptions": "openany", +} latex_engine = "xelatex" +# Enable shell escape for SVG package (requires inkscape or rsvg-convert installed) +latex_use_xindy = False +latex_additional_files = [] + # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). diff --git a/doc/source/mapdl_commands/prep7/database.rst b/doc/source/mapdl_commands/prep7/database.rst index 0a0d900275e..7fe48d20568 100644 --- a/doc/source/mapdl_commands/prep7/database.rst +++ b/doc/source/mapdl_commands/prep7/database.rst @@ -1,28 +1,31 @@ -.. _ref_database_commands_api: -******** +.. _ref_database: + + Database -******** +======== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.prep7.database -These PREP7 commands are used to read model data into the database, -list out the database, and control the numbering of entities in the -database. +.. autoclass:: ansys.mapdl.core._commands.prep7.database.Database .. autosummary:: - :toctree: _autosummary/ - - Mapdl.aflist - Mapdl.cdread - Mapdl.cdwrite - Mapdl.cdopt - Mapdl.cecheck - Mapdl.check - Mapdl.igesout - Mapdl.mfimport - Mapdl.nooffset - Mapdl.numcmp - Mapdl.nummrg - Mapdl.numoff - Mapdl.numstr + :template: base.rst + :toctree: _autosummary + + + Database.aflist + Database.cdopt + Database.cdread + Database.cdwrite + Database.cecheck + Database.check + Database.cncheck + Database.escheck + Database.igesout + Database.nooffset + Database.numcmp + Database.nummrg + Database.numoff + Database.numstr diff --git a/doc/source/mapdl_commands/prep7/digitizing.rst b/doc/source/mapdl_commands/prep7/digitizing.rst deleted file mode 100644 index 78efdf8ae35..00000000000 --- a/doc/source/mapdl_commands/prep7/digitizing.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. _ref_digitizing_commands_api: - -********** -Digitizing -********** - -.. currentmodule:: ansys.mapdl.core - -These PREP7 commands are used to define nodes by tablet digitizing. - -.. autosummary:: - :toctree: _autosummary/ - - Mapdl.dig - Mapdl.dmove - Mapdl.dset - Mapdl.dsurf diff --git a/doc/source/mapdl_commands/prep7/element_type.rst b/doc/source/mapdl_commands/prep7/element_type.rst index 3eaa014ac7c..a9d81bf19a4 100644 --- a/doc/source/mapdl_commands/prep7/element_type.rst +++ b/doc/source/mapdl_commands/prep7/element_type.rst @@ -1,22 +1,25 @@ -.. _ref_element_type_commands_api: -************ -Element type -************ +.. _ref_element_type: -.. currentmodule:: ansys.mapdl.core -These PREP7 commands define the type of elements to be used in the model. +ElementType +=========== + + +.. currentmodule:: ansys.mapdl.core._commands.prep7.element_type + +.. autoclass:: ansys.mapdl.core._commands.prep7.element_type.ElementType .. autosummary:: - :toctree: _autosummary/ - - Mapdl.dof - Mapdl.elbow - Mapdl.et - Mapdl.etchg - Mapdl.etcontrol - Mapdl.etdele - Mapdl.etlist - Mapdl.keyopt - Mapdl.nsvr + :template: base.rst + :toctree: _autosummary + + + ElementType.dof + ElementType.et + ElementType.etchg + ElementType.etcontrol + ElementType.etdele + ElementType.etlist + ElementType.keyopt + ElementType.nsvr diff --git a/doc/source/mapdl_commands/prep7/elements.rst b/doc/source/mapdl_commands/prep7/elements.rst index f2cb8fad5bb..68b8e40af02 100644 --- a/doc/source/mapdl_commands/prep7/elements.rst +++ b/doc/source/mapdl_commands/prep7/elements.rst @@ -1,54 +1,62 @@ -.. _ref_elements_commands_api: -******** +.. _ref_elements: + + Elements -******** +======== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.prep7.elements -These PREP7 commands are used to create, modify, list, etc., elements. +.. autoclass:: ansys.mapdl.core._commands.prep7.elements.Elements .. autosummary:: - :toctree: _autosummary/ - - Mapdl.afsurf - Mapdl.e - Mapdl.ecpchg - Mapdl.edele - Mapdl.eextrude - Mapdl.egen - Mapdl.einfin - Mapdl.eintf - Mapdl.elist - Mapdl.emid - Mapdl.emodif - Mapdl.emore - Mapdl.emtgen - Mapdl.en - Mapdl.endrelease - Mapdl.engen - Mapdl.enorm - Mapdl.ensym - Mapdl.eread - Mapdl.ereinf - Mapdl.errang - Mapdl.esurf - Mapdl.esym - Mapdl.ewrite - Mapdl.gcdef - Mapdl.gcgen - Mapdl.inistate - Mapdl.laylist - Mapdl.layplot - Mapdl.lfsurf - Mapdl.ndsurf - Mapdl.shsd - Mapdl.swadd - Mapdl.swdel - Mapdl.swgen - Mapdl.swlist - Mapdl.tshap - Mapdl.upgeom - Mapdl.usrdof - Mapdl.usrelem - Mapdl.wtbcreate + :template: base.rst + :toctree: _autosummary + + + Elements.afsurf + Elements.dflab + Elements.e + Elements.ecpchg + Elements.edele + Elements.eembed + Elements.egen + Elements.egid + Elements.einfin + Elements.eintf + Elements.elbow + Elements.elist + Elements.emid + Elements.emodif + Elements.emore + Elements.emsel + Elements.emtgen + Elements.en + Elements.endrelease + Elements.engen + Elements.enorm + Elements.ensym + Elements.eplot + Elements.eread + Elements.ereinf + Elements.errang + Elements.esurf + Elements.esym + Elements.ewrite + Elements.gcdef + Elements.gcgen + Elements.laylist + Elements.layplot + Elements.lfsurf + Elements.ndsurf + Elements.shsd + Elements.swadd + Elements.swdel + Elements.swgen + Elements.swlist + Elements.tshap + Elements.upgeom + Elements.usrdof + Elements.usrelem + Elements.wtbcreate diff --git a/doc/source/mapdl_commands/prep7/explicit_dynamics.rst b/doc/source/mapdl_commands/prep7/explicit_dynamics.rst index 5750016659d..f1c48208e07 100644 --- a/doc/source/mapdl_commands/prep7/explicit_dynamics.rst +++ b/doc/source/mapdl_commands/prep7/explicit_dynamics.rst @@ -1,80 +1,56 @@ -.. _ref_explicit_dynamics_commands_api: -***************** -Explicit dynamics -***************** +.. _ref_explicit_dynamics: -.. currentmodule:: ansys.mapdl.core -These PREP7 commands are used for an explicit dynamic analysis. +ExplicitDynamics +================ -.. autosummary:: - :toctree: _autosummary/ - - Mapdl.edasmp - Mapdl.edbound - Mapdl.edbx - Mapdl.edcgen - Mapdl.edclist - Mapdl.edcmore - Mapdl.edcnstr - Mapdl.edcontact - Mapdl.edcrb - Mapdl.edcurve - Mapdl.eddbl - Mapdl.eddc - Mapdl.edipart - Mapdl.edlcs - Mapdl.edmp - Mapdl.ednb - Mapdl.edndtsd - Mapdl.ednrot - Mapdl.edpart - Mapdl.edpc - Mapdl.edsp - Mapdl.edweld +.. currentmodule:: ansys.mapdl.core._commands.prep7.explicit_dynamics - .. currentmodule:: ansys.mapdl.core - -These SOLUTION commands are used for an explicit dynamic analysis. +.. autoclass:: ansys.mapdl.core._commands.prep7.explicit_dynamics.ExplicitDynamics .. autosummary:: - :toctree: _autosummary/ - - Mapdl.edadapt - Mapdl.edale - Mapdl.edbvis - Mapdl.edcadapt - Mapdl.edcpu - Mapdl.edcsc - Mapdl.edcts - Mapdl.eddamp - Mapdl.eddrelax - Mapdl.eddump - Mapdl.edenergy - Mapdl.edfplot - Mapdl.edgcale - Mapdl.edhgls - Mapdl.edhist - Mapdl.edhtime - Mapdl.edint - Mapdl.edis - Mapdl.edload - Mapdl.edopt - Mapdl.edout - Mapdl.edpl - Mapdl.edpvel - Mapdl.edrc - Mapdl.edrd - Mapdl.edri - Mapdl.edrst - Mapdl.edrun - Mapdl.edshell - Mapdl.edsolv - Mapdl.edstart - Mapdl.edterm - Mapdl.edtp - Mapdl.edvel - Mapdl.edwrite - Mapdl.rexport + :template: base.rst + :toctree: _autosummary + + + ExplicitDynamics.edadapt + ExplicitDynamics.edbvis + ExplicitDynamics.edclist + ExplicitDynamics.edcmore + ExplicitDynamics.edcnstr + ExplicitDynamics.edcpu + ExplicitDynamics.edcrb + ExplicitDynamics.edcsc + ExplicitDynamics.edcts + ExplicitDynamics.edcurve + ExplicitDynamics.eddamp + ExplicitDynamics.eddbl + ExplicitDynamics.eddc + ExplicitDynamics.eddump + ExplicitDynamics.edenergy + ExplicitDynamics.edfplot + ExplicitDynamics.edgcale + ExplicitDynamics.edhgls + ExplicitDynamics.edhist + ExplicitDynamics.edhtime + ExplicitDynamics.edint + ExplicitDynamics.edis + ExplicitDynamics.ednb + ExplicitDynamics.edopt + ExplicitDynamics.edout + ExplicitDynamics.edpart + ExplicitDynamics.edpc + ExplicitDynamics.edpl + ExplicitDynamics.edrc + ExplicitDynamics.edrd + ExplicitDynamics.edrst + ExplicitDynamics.edrun + ExplicitDynamics.edshell + ExplicitDynamics.edsolv + ExplicitDynamics.edsp + ExplicitDynamics.edstart + ExplicitDynamics.edterm + ExplicitDynamics.edwrite + ExplicitDynamics.rexport diff --git a/doc/source/mapdl_commands/prep7/hard_points.rst b/doc/source/mapdl_commands/prep7/hard_points.rst index 3bbe4081bdf..8be147ee928 100644 --- a/doc/source/mapdl_commands/prep7/hard_points.rst +++ b/doc/source/mapdl_commands/prep7/hard_points.rst @@ -1,15 +1,19 @@ -.. _ref_hard_points_commands_api: -*********** -Hard points -*********** +.. _ref_hard_points: -.. currentmodule:: ansys.mapdl.core -These PREP7 commands are used to create, modify, list, etc., hard points. +HardPoints +========== + + +.. currentmodule:: ansys.mapdl.core._commands.prep7.hard_points + +.. autoclass:: ansys.mapdl.core._commands.prep7.hard_points.HardPoints .. autosummary:: - :toctree: _autosummary/ + :template: base.rst + :toctree: _autosummary + - Mapdl.hptcreate - Mapdl.hptdelete + HardPoints.hptcreate + HardPoints.hptdelete diff --git a/doc/source/mapdl_commands/prep7/index.rst b/doc/source/mapdl_commands/prep7/index.rst index b018c482ff7..014fc9fefb6 100644 --- a/doc/source/mapdl_commands/prep7/index.rst +++ b/doc/source/mapdl_commands/prep7/index.rst @@ -32,6 +32,7 @@ Prep7 * - :ref:`ref_artificially_matched_layers` * - :ref:`ref_real_constants` * - :ref:`ref_superelements` + * - :ref:`ref_explicit_dynamics` .. toctree:: @@ -40,11 +41,20 @@ Prep7 areas booleans + meshing + database + elements cross_sections + lines data_tables constraint_equations constraint_equations_ coupled_dof + morphing + element_type + materials _status + keypoints + hard_points artificially_matched_layers - meshing + explicit_dynamics diff --git a/doc/source/mapdl_commands/prep7/keypoints.rst b/doc/source/mapdl_commands/prep7/keypoints.rst index 47a1afd883e..2c18b8f5c4b 100644 --- a/doc/source/mapdl_commands/prep7/keypoints.rst +++ b/doc/source/mapdl_commands/prep7/keypoints.rst @@ -1,31 +1,37 @@ -.. _ref_Keypoints_commands_api: -********* +.. _ref_keypoints: + + Keypoints -********* +========= + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.prep7.keypoints -These PREP7 commands are used to create, modify, list, etc., keypoints. +.. autoclass:: ansys.mapdl.core._commands.prep7.keypoints.Keypoints .. autosummary:: - :toctree: _autosummary/ - - Mapdl.k - Mapdl.kbetw - Mapdl.kcenter - Mapdl.kdele - Mapdl.kdist - Mapdl.kfill - Mapdl.kgen - Mapdl.kl - Mapdl.klist - Mapdl.kmodif - Mapdl.kmove - Mapdl.knode - Mapdl.kpscale - Mapdl.kscale - Mapdl.ksum - Mapdl.ksymm - Mapdl.ktran - Mapdl.source + :template: base.rst + :toctree: _autosummary + + + Keypoints.gsum + Keypoints.k + Keypoints.kbetw + Keypoints.kcenter + Keypoints.kdele + Keypoints.kdist + Keypoints.kfill + Keypoints.kgen + Keypoints.kl + Keypoints.klist + Keypoints.kmodif + Keypoints.kmove + Keypoints.knode + Keypoints.kplot + Keypoints.kpscale + Keypoints.kscale + Keypoints.ksum + Keypoints.ksymm + Keypoints.ktran + Keypoints.source diff --git a/doc/source/mapdl_commands/prep7/lines.rst b/doc/source/mapdl_commands/prep7/lines.rst index 9391d8ab08d..875a102ea82 100644 --- a/doc/source/mapdl_commands/prep7/lines.rst +++ b/doc/source/mapdl_commands/prep7/lines.rst @@ -1,39 +1,44 @@ -.. _ref_lines_commands_api: -***** +.. _ref_lines: + + Lines -***** +===== + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.prep7.lines -These PREP7 commands are used to create, modify, list, etc., lines. +.. autoclass:: ansys.mapdl.core._commands.prep7.lines.Lines .. autosummary:: - :toctree: _autosummary/ - - Mapdl.bsplin - Mapdl.circle - Mapdl.l - Mapdl.l2ang - Mapdl.l2tan - Mapdl.lang - Mapdl.larc - Mapdl.larea - Mapdl.lcomb - Mapdl.ldele - Mapdl.ldiv - Mapdl.ldrag - Mapdl.lextnd - Mapdl.lfillt - Mapdl.lgen - Mapdl.llist - Mapdl.lreverse - Mapdl.lrotat - Mapdl.lsscale - Mapdl.lstr - Mapdl.lsum - Mapdl.lsymm - Mapdl.ltan - Mapdl.ltran - Mapdl.spline - Mapdl.ssln + :template: base.rst + :toctree: _autosummary + + + Lines.bsplin + Lines.circle + Lines.l + Lines.l2ang + Lines.l2tan + Lines.lang + Lines.larc + Lines.larea + Lines.lcomb + Lines.ldele + Lines.ldiv + Lines.ldrag + Lines.lextnd + Lines.lfillt + Lines.lgen + Lines.llist + Lines.lplot + Lines.lreverse + Lines.lrotat + Lines.lsscale + Lines.lstr + Lines.lsum + Lines.lsymm + Lines.ltan + Lines.ltran + Lines.spline + Lines.ssln diff --git a/doc/source/mapdl_commands/prep7/material_data_tables.rst b/doc/source/mapdl_commands/prep7/material_data_tables.rst deleted file mode 100644 index a4bbbc102eb..00000000000 --- a/doc/source/mapdl_commands/prep7/material_data_tables.rst +++ /dev/null @@ -1,25 +0,0 @@ -.. _ref_material_data_tables_commands_api: - -******************** -Material data tables -******************** - -.. currentmodule:: ansys.mapdl.core - -These PREP7 commands create and modify the material data tables (that is, to specify and define material models). - -.. autosummary:: - :toctree: _autosummary/ - - Mapdl.tb - Mapdl.tbcopy - Mapdl.tbdata - Mapdl.tbdele - Mapdl.tbeo - Mapdl.tbfield - Mapdl.tbin - Mapdl.tblist - Mapdl.tbmodif - Mapdl.tbplot - Mapdl.tbpt - Mapdl.tbtemp diff --git a/doc/source/mapdl_commands/prep7/materials.rst b/doc/source/mapdl_commands/prep7/materials.rst index 025223d2a75..13cd2c1b5c5 100644 --- a/doc/source/mapdl_commands/prep7/materials.rst +++ b/doc/source/mapdl_commands/prep7/materials.rst @@ -1,31 +1,40 @@ -.. _ref_materials_commands_api: -********* +.. _ref_materials: + + Materials -********* +========= + -.. currentmodule:: ansys.mapdl.core +.. currentmodule:: ansys.mapdl.core._commands.prep7.materials -These PREP7 commands are used to define the linear material properties. +.. autoclass:: ansys.mapdl.core._commands.prep7.materials.Materials .. autosummary:: - :toctree: _autosummary/ - - Mapdl.emunit - Mapdl.mp - Mapdl.mpamod - Mapdl.mpchg - Mapdl.mpcopy - Mapdl.mpdata - Mapdl.mpdele - Mapdl.mpdres - Mapdl.mplib - Mapdl.mplist - Mapdl.mpplot - Mapdl.mpread - Mapdl.mptemp - Mapdl.mptgen - Mapdl.mptres - Mapdl.mpwrite - Mapdl.tbft - Mapdl.uimp + :template: base.rst + :toctree: _autosummary + + + Materials.emunit + Materials.fc + Materials.fccheck + Materials.fcdele + Materials.fclist + Materials.mp + Materials.mpamod + Materials.mpchg + Materials.mpcopy + Materials.mpdata + Materials.mpdele + Materials.mpdres + Materials.mplib + Materials.mplist + Materials.mpplot + Materials.mpread + Materials.mptemp + Materials.mptgen + Materials.mptres + Materials.mpwrite + Materials.tbfplot + Materials.tbft + Materials.uimp diff --git a/doc/source/mapdl_commands/prep7/morphing.rst b/doc/source/mapdl_commands/prep7/morphing.rst index 030f8436ba6..e4229581cc8 100644 --- a/doc/source/mapdl_commands/prep7/morphing.rst +++ b/doc/source/mapdl_commands/prep7/morphing.rst @@ -1,17 +1,21 @@ -.. _ref_morphing_commands_api: -******** +.. _ref_morphing: + + Morphing -******** +======== -.. currentmodule:: ansys.mapdl.core -These PREP7 commands are used to adjust the finite element mesh in the non-structural regions to coincide with the deflections of the structural regions. +.. currentmodule:: ansys.mapdl.core._commands.prep7.morphing + +.. autoclass:: ansys.mapdl.core._commands.prep7.morphing.Morphing .. autosummary:: - :toctree: _autosummary/ + :template: base.rst + :toctree: _autosummary + - Mapdl.morph - Mapdl.damorph - Mapdl.demorph - Mapdl.dvmorph + Morphing.damorph + Morphing.demorph + Morphing.dvmorph + Morphing.morph diff --git a/src/ansys/mapdl/core/_commands/prep7/__init__.py b/src/ansys/mapdl/core/_commands/prep7/__init__.py index 50cbcba29ba..2647109d921 100644 --- a/src/ansys/mapdl/core/_commands/prep7/__init__.py +++ b/src/ansys/mapdl/core/_commands/prep7/__init__.py @@ -30,5 +30,14 @@ coupled_dof, cross_sections, data_tables, + database, + element_type, + elements, + explicit_dynamics, + hard_points, + keypoints, + lines, + materials, meshing, + morphing, ) diff --git a/src/ansys/mapdl/core/_commands/prep7/areas.py b/src/ansys/mapdl/core/_commands/prep7/areas.py index 188a9c8195e..d38d98638c3 100644 --- a/src/ansys/mapdl/core/_commands/prep7/areas.py +++ b/src/ansys/mapdl/core/_commands/prep7/areas.py @@ -741,7 +741,7 @@ def anorm(self, anum: str = "", noeflip: int | str = "", **kwargs): an element reversal. See `Revising Your Model - `_ of the + `_ of the `Modeling and Meshing Guide `_ for more information. @@ -1246,7 +1246,7 @@ def askin( To further control the geometry of the area (if ``NL1`` is negative), the beginning and end of any specified line (other than ``NL1`` ) can be temporarily interchanged (for the skinning operation only) by inputting that line number as negative. See `Solid Modeling - `_ in the + `_ in the `Modeling and Meshing Guide `_ for an illustration. diff --git a/src/ansys/mapdl/core/_commands/prep7/booleans.py b/src/ansys/mapdl/core/_commands/prep7/booleans.py index 6329d57cf0e..3f65dad2c50 100644 --- a/src/ansys/mapdl/core/_commands/prep7/booleans.py +++ b/src/ansys/mapdl/core/_commands/prep7/booleans.py @@ -490,7 +490,7 @@ def aovlap( Generates new areas which encompass the geometry of all the input areas. The new areas are defined by the regions of intersection of the input areas, and by the complementary (non-intersecting) regions. See `Solid Modeling - `_ in + `_ in the `Modeling and Meshing Guide `_ for an illustration. This operation is only valid when the region of intersection is an @@ -656,7 +656,7 @@ def asba( resulting areas will be connected, sharing a common line where they touch. If ``SEPO`` is set to SEPO, ``NA1`` is divided into two unconnected areas with separate lines where they touch. See `Solid Modeling `_ - in the `Modeling and Meshing Guide + in the `Modeling and Meshing Guide `_ for an illustration. See the :ref:`boptn` command for an explanation of the options available to Boolean operations. Element attributes and solid model boundary conditions @@ -722,7 +722,7 @@ def asbl( Generates new areas by subtracting the regions common to both the areas and lines (the intersection) from the ``NA`` areas. The intersection will be a line(s). See `Solid Modeling - `_ in the + `_ in the `Modeling and Meshing Guide `_ for an illustration. See the :ref:`boptn` command for an explanation of the options @@ -793,7 +793,7 @@ def asbv( resulting areas will be connected, sharing a common line where they touch. If ``SEPO`` is set to SEPO, ``NA`` is divided into two unconnected areas with separate lines where they touch. See `Solid Modeling `_ - in the `Modeling and Meshing Guide + in the `Modeling and Meshing Guide `_ for an illustration. See the :ref:`boptn` command for an explanation of the options available to Boolean operations. Element attributes and solid model boundary conditions @@ -842,7 +842,7 @@ def asbw(self, na: str = "", sepo: str = "", keep: str = "", **kwargs): be connected, sharing a common line where they touch. If ``SEPO`` is set to SEPO, ``NA`` is divided into two unconnected areas with separate lines. The SEPO option may cause unintended consequences if any keypoints exist along the cut plane. See `Solid Modeling - `_ in the + `_ in the `Modeling and Meshing Guide `_ for an illustration. See the :ref:`boptn` command for an explanation of the options diff --git a/src/ansys/mapdl/core/_commands/prep7/cross_sections.py b/src/ansys/mapdl/core/_commands/prep7/cross_sections.py index 007c83f9e9e..607eaac41b3 100644 --- a/src/ansys/mapdl/core/_commands/prep7/cross_sections.py +++ b/src/ansys/mapdl/core/_commands/prep7/cross_sections.py @@ -391,7 +391,7 @@ def cbmd( The :ref:`cbmd` command, one of several `composite beam section commands `_, - specifies the section mass matrix (submatrix [ **C** ] data) for a composite beam section. + specifies the section mass matrix (submatrix [ **C** ] data) for a composite beam section. The section data defined is associated with the section most recently defined ( :ref:`sectype` ) at the specified temperature ( :ref:`cbtmp` ). @@ -489,7 +489,7 @@ def cbte(self, alpha: str = "", **kwargs): `_, specifies a thermal expansion coefficient for a beam section. The value specified is associated with the section most recently defined ( :ref:`sectype` ) at the specified temperature ( :ref:`cbtmp` - ). + ). Unspecified values default to zero. @@ -1114,7 +1114,7 @@ def secdata( External material ( ``M`` :sub:`ins` ) adds mass and increases hydraulic diameter, but does not add to stiffness. - .. figure::../../../images/_commands/gSECD_pipe.svg + .. figure:: ../../../images/_commands/gSECD_pipe.svg .. _SECDATA_pretension: @@ -1202,15 +1202,15 @@ def secdata( When applied to 8-node or 20-node layered solid elements: - .. figure::../../../images/_commands/gSECD18.svg + .. figure:: ../../../images/_commands/gSECD18.svg - .. figure::../../../images/_commands/gSECD19.svg + .. figure:: ../../../images/_commands/gSECD19.svg When applied to 4-node or 8-node layered shell elements: - .. figure::../../../images/_commands/gSECD20.svg + .. figure:: ../../../images/_commands/gSECD20.svg - .. figure::../../../images/_commands/gSECD21.svg + .. figure:: ../../../images/_commands/gSECD21.svg **PATT: EDGO** @@ -1235,11 +1235,11 @@ def secdata( When applied to 8-node or 20-node solid elements: - .. figure::../../../images/_commands/gSECD22.svg + .. figure:: ../../../images/_commands/gSECD22.svg - .. figure::../../../images/_commands/gSECD22b.svg + .. figure:: ../../../images/_commands/gSECD22b.svg - .. figure::../../../images/_commands/gSECD22c.svg + .. figure:: ../../../images/_commands/gSECD22c.svg When applied to tetrahedral elements: @@ -1248,13 +1248,13 @@ def secdata( When applied to 3D shell elements: - .. figure::../../../images/_commands/gSECD28.svg + .. figure:: ../../../images/_commands/gSECD28.svg - .. figure::../../../images/_commands/gSECD29.svg + .. figure:: ../../../images/_commands/gSECD29.svg When applied to beam or link elements: - .. figure::../../../images/_commands/gSECD30.svg + .. figure:: ../../../images/_commands/gSECD30.svg **PATT: BEAM** @@ -1271,7 +1271,7 @@ def secdata( ``Y1``, and the default value for ``Z2`` is ``Z1``. (Because ``V3`` and ``V4`` values apply only to tapered beams, the program ignores them if the base beam has a constant section.) - .. figure::../../../images/_commands/gSECD31.svg + .. figure:: ../../../images/_commands/gSECD31.svg - - - - - - - - - - - - - - - - - - - - - @@ -1378,7 +1378,7 @@ def secdata( When applied to 3D shell elements: - .. figure::../../../images/_commands/gSECD16.svg + .. figure:: ../../../images/_commands/gSECD16.svg .. _SECDATA_shells: @@ -2087,7 +2087,7 @@ def secoffset( The following figure illustrates the offsets for a channel cross section, and shows the relative locations of SHRC and CENT. - .. figure::../../../images/_commands/gSECO1.svg + .. figure:: ../../../images/_commands/gSECO1.svg Offsets for a CHAN Section Subtype @@ -2235,7 +2235,7 @@ def secplot( Following is a sample section plot for the beam section type: - .. figure::../../../images/_commands/gSECP1.jpg + .. figure:: ../../../images/_commands/gSECP1.jpg .. _SECPLOT_shells: @@ -2250,7 +2250,7 @@ def secplot( Following is a sample section plot for the shell section type: - .. figure::../../../images/_commands/gsecplotshell.jpg + .. figure:: ../../../images/_commands/gsecplotshell.jpg .. _SECPLOT_reinf: @@ -2273,7 +2273,7 @@ def secplot( Following is a sample section plot for the reinforcing section type: - .. figure::../../../images/_commands/gSECP.fig.3.jpg + .. figure:: ../../../images/_commands/gSECP.fig.3.jpg For more information about reinforcing, see the documentation for the :ref:`secdata` command, and the ``REINF264`` and ``REINF265`` elements. @@ -2360,11 +2360,11 @@ def secread(self, fname: str = "", ext: str = "", option: str = "", **kwargs): numbered consecutively, with the first node having a node number of 1, and the last node having a node number that is equal to the maximum number of nodes in the cell mesh. - .. figure::../../../images/_commands/gSECR2.svg + .. figure:: ../../../images/_commands/gSECR2.svg Two-hole Box Section - .. figure::../../../images/_commands/gSECR3.svg + .. figure:: ../../../images/_commands/gSECR3.svg Cell Mesh for the Two-hole Box Section """ @@ -2525,7 +2525,7 @@ def sectype( The following figure shows the shape of each cross section subtype: - .. figure::../../../images/_commands/gSECT1.svg + .. figure:: ../../../images/_commands/gSECT1.svg When ``Type`` = COMB, the only possible `composite-beam section `_ @@ -3077,7 +3077,7 @@ def ssbt( The :ref:`ssbt` command, one of several `preintegrated shell section commands `_, - specifies the bending thermal effects quantity (submatrix [ **B** :sup:`T` ] data) for a + specifies the bending thermal effects quantity (submatrix [ **B** :sup:`T` ] data) for a preintegrated shell section. The section data defined is associated with the section most recently defined (via the :ref:`sectype` command). @@ -3205,7 +3205,7 @@ def sspa( The :ref:`sspa` command, one of several `preintegrated shell section commands `_, - specifies the membrane stiffness quantity (submatrix [ **A** ]) for a preintegrated shell + specifies the membrane stiffness quantity (submatrix [ **A** ]) for a preintegrated shell section. The section data defined is associated with the section most recently defined (via the :ref:`sectype` command). diff --git a/src/ansys/mapdl/core/_commands/prep7/data_tables.py b/src/ansys/mapdl/core/_commands/prep7/data_tables.py index ddca04162e5..2e6ca6b92ca 100644 --- a/src/ansys/mapdl/core/_commands/prep7/data_tables.py +++ b/src/ansys/mapdl/core/_commands/prep7/data_tables.py @@ -41,7 +41,7 @@ def cbtmp(self, temp: str = "", **kwargs): (preintegrated cross-section stiffness), :ref:`cbmd` (preintegrated section mass), or :ref:`cbte` (thermal-expansion) commands. - The specified temperature remains active unt il the next :ref:`cbtmp` command is issued. + The specified temperature remains active unt il the next :ref:`cbtmp` command is issued. An unspecified temperature value defaults to zero. diff --git a/src/ansys/mapdl/core/_commands/prep7/database.py b/src/ansys/mapdl/core/_commands/prep7/database.py new file mode 100644 index 00000000000..54f8c5d4d19 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/database.py @@ -0,0 +1,1479 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Database: + + def aflist(self, **kwargs): + r"""Lists the current data in the database. + + Mechanical APDL Command: `AFLIST `_ + + Notes + ----- + + .. _AFLIST_notes: + + Lists the current data and specifications in the database. If batch, lists all appropriate data. If + interactive, lists only summaries. + """ + command = "AFLIST" + return self.run(command, **kwargs) + + def cdopt(self, option: str = "", **kwargs): + r"""Specifies format to be used for archiving geometry. + + Mechanical APDL Command: `CDOPT `_ + + Parameters + ---------- + option : str + * ``IGES`` - Write solid model geometry information using IGES format (default). + + * ``ANF`` - Write solid model geometry information using Ansys Neutral File (ANF) format. + + * ``STAT`` - Print out the current format setting. + + Notes + ----- + + .. _CDOPT_notes: + + This command controls your solid model geometry format for :ref:`cdwrite` operations. The ANF option + affects only the COMB and SOLID options of the :ref:`cdwrite` command. All other options remain + unaffected. + + This option setting is saved in the database. + """ + command = f"CDOPT,{option}" + return self.run(command, **kwargs) + + def cdread( + self, + option: str = "", + fname: str = "", + ext: str = "", + fnamei: str = "", + exti: str = "", + **kwargs, + ): + r"""Reads a file of solid model and database information into the database. + + Mechanical APDL Command: `CDREAD `_ + + Parameters + ---------- + option : str + Selects which data to read: + + * ``ALL`` - Read all geometry, material property, load, and component data (default). Solid model + geometry and loads will be read from the file :file:`fnamei.exti`. All other data will be read from + the file :file:`fname.ext.` None + + * ``DB`` - Read all database information contained in file :file:`Fname.Ext`. This file should + contain all information mentioned above except the solid model loads. If reading a :file:`.CDB` file + written with the GEOM option of the :ref:`cdwrite` command, element types ( :ref:`et` ) compatible + with the connectivity of the elements on the file must be defined prior to reading. + + * ``SOLID`` - Read the solid model geometry and solid model loads from the file :file:`Fnamei.Exti`. + This file could have been written by the :ref:`cdwrite` or :ref:`igesout` command. + + * ``COMB`` - Read the combined solid model and database information from the file :file:`Fname.Ext.` + None + + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to :file:`.cdb` if + ``Fname`` is blank. + + fnamei : str + Name of the IGES file and its directory path (248 characters maximum, including directory). If + you do not specify a directory path, it will default to your working directory and you can use + all 248 characters for the file name. + + The file name defaults to ``Fname``. Used only if ``Option`` = ALL or SOLID. + + exti : str + Filename extension (eight-character maximum). Defaults to IGES if ``Fnamei`` is blank. + + Notes + ----- + + .. _CDREAD_notes: + + This command causes coded files of solid model (in IGES format) and database (in command format) + information to be read. These files are normally written by the :ref:`cdwrite` or :ref:`igesout` + command. Note that the active coordinate system in these files has been reset to Cartesian ( + :ref:`csys`,0). + + If a set of data exists prior to the :ref:`cdread` operation, that data set is offset upward to + allow the new data to fit without overlap. The :ref:`nooffset` command allows this offset to be + ignored on a set-by-set basis, causing the existing data set to be overwritten with the new data + set. + + When you write the geometry data using the :ref:`cdwrite`,GEOM option, you use the :ref:`cdread`,DB + option to read the geometry information. + + Using the :ref:`cdread`,COMB option will not write :ref:`numoff` commands to offset entity ID + numbers if there is no solid model in the database. + + Multiple :file:`.cdb` file imports cannot have elements with real constants in one file and section + definitions in another. The section attributes will override the real constant attributes. If you + use :ref:`cdread` to import multiple CDB files, define all of the elements using only real + constants, or using only section definitions. Combining real constants and section definitions is + not recommended. + + If a radiosity mapping data file ( :file:`.rsm` file) was saved by the previous :ref:`cdwrite` + command, that mapping file must be present in the directory along with the coded geometry file in + order for radiosity surface elements ( ``SURF251``, ``SURF252`` ) to be correctly mapped onto the + model when :ref:`cdread` is issued. + + If you issue :ref:`cdwrite` to import a :file:`.cdb` file containing a `user-defined element + `_, + manually insert :ref:`usrelem` and :ref:`usrdof` commands in the :file:`.cdb` file to provide the + user-defined element characteristics. Insert the two commands after the :ref:`et` command (defining + the user-defined element) and before the ``EBLOCK`` command. (If multiple element types are defined + in the :file:`.cdb` file, insert the :ref:`type` command to select the user-defined element. Place + it before :ref:`usrelem` and :ref:`usrdof`.) + + This command is valid in any processor. + """ + command = f"CDREAD,{option},{fname},{ext},,{fnamei},{exti}" + return self.run(command, **kwargs) + + def cdwrite( + self, + option: str = "", + fname: str = "", + ext: str = "", + fnamei: str = "", + exti: str = "", + fmat: str = "", + **kwargs, + ): + r"""Writes geometry and load database items to a file. + + Mechanical APDL Command: `CDWRITE `_ + + Parameters + ---------- + option + Selects which data to write: + + ALL + Write all appropriate geometry, material property, + load, and component data (default). Two files will + be produced. ``Fname.Ext`` will contain all data items + mentioned in "Notes", except the solid model + data. ``Fnamei.Exti`` will contain the solid model + geometry and solid model loads data in the form of + ``IGES`` commands. This option is not valid when + ``CDOPT,ANF`` is active. + + COMB + Write all data mentioned, but to a single file, + ``Fname.Ext``. Solid model geometry data will be + written in either ``IGES`` or ``ANF`` format as specified + in the ``CDOPT`` command, followed by the remainder of + the data in the form of ANSYS commands. More + information on these (IGES/ANF) file formats is + provided in "Notes". + + DB + Write all database information except the solid model + and solid model loads to ``Fname.Ext`` in the form of + ANSYS commands. This option is not valid when + ``CDOPT,ANF`` is active. + + SOLID + Write only the solid model geometry and solid + model load data. This output will be in IGES or + ANF format, as specified in the ``CDOPT`` + command. More information on these (``IGES/ANF``) file + formats is provided in "Notes". + + GEOM + Write only element and nodal geometry data. Neither + solid model geometry nor element attribute data + will be written. One file, ``Fname.Ext``, will be + produced. Use ``CDREAD,DB`` to read in a file written + with this option. Element types [``ET``] compatible + with the connectivity of the elements on the file + must first be defined before reading the file in + with ``CDREAD,DB``. + + CM + Write only node and element component and geometry + data to ``Fname.Ext``. + + MAT + Write only material property data (both linear and + nonlinear) to ``Fname.Ext``. + + LOAD + Write only loads for current load step to + ``Fname.Ext``. + + SECT + Write only section data to ``Fname.Ext``. Pretension + sections are not included. + + fname + File name and directory path (248 characters maximum, + including the characters needed for the directory path). + An unspecified directory path defaults to the working + directory; in this case, you can use all 248 characters + for the file name. + + ext + Filename extension (eight-character maximum). + + fnamei + Name of the IGES file and its directory path (248 + characters maximum, including directory). If you do not + specify a directory path, it will default to your working + directory and you can use all 248 characters for the file + name. + + exti + Filename extension (eight-character maximum). + + fmat + Format of the output file (defaults to BLOCKED). + + BLOCKED + Blocked format. This format allows faster + reading of the output file. The time savings is + most significant when BLOCKED is used to read + .cdb files associated with very large models. + + UNBLOCKED + Unblocked format. + + Returns + ------- + str + Mapdl command output. + + Notes + ----- + + .. _CDWRITE_notes: + + Load data includes the current load step only. Loads applied to the solid model (if any) are + automatically transferred to the finite element model when this command is issued. :ref:`cdwrite` + writes out solid model loads for meshed models only. If the model is not meshed, the solid model + loads cannot be saved. Component data include component definitions, but not assembly definitions. + Appropriate :ref:`numoff` commands are included at the beginning of the file; this is to avoid + overlap of an existing database when the file is read in. + + Solution control commands are typically not written to the file unless you specifically change a + default solution setting. + + :ref:`cdwrite` does not support the :ref:`gsbdata` and :ref:`gsgdata` commands, and these commands + are not written to the file. + + The data may be reread (on a different machine, for example) with the :ref:`cdread` command. + Caution: When the file is read in, the :ref:`numoff`,MAT command may cause a mismatch between + material definitions and material numbers referenced by certain loads and element real constants. + See :ref:`numoff` for details. Also, be aware that the files created by the :ref:`cdwrite` command + explicitly set the active coordinate system to Cartesian ( :ref:`csys`,0). + + You should generally use the blocked format ( ``Fmat`` = BLOCKED) when writing out model data with + :ref:`cdwrite`. This is a compressed data format that greatly reduces the time required to read + large models through the :ref:`cdread` command. The blocked and unblocked formats are described in + `The CDWRITE (CDB) File Format + `_ + + If you use :ref:`cdwrite` in any of the derived products (Ansys Mechanical Pro, Ansys Mechanical + Premium), then before reading the + file, you must edit the :file:`Jobname.cdb` file to remove commands that are not available in the + respective component product. + + The :ref:`cdwrite` command does not support (for beam meshing) any line operation that relies on + solid model associativity. For example, meshing the areas adjacent to the meshed line, plotting the + line that contains the orientation nodes, or clearing the mesh from the line that contains + orientation nodes may not work as expected. For more information about beam meshing, see `Meshing + Your Solid Model + `_ in the + `Modeling and Meshing Guide + `_. + + If you issue :ref:`cdwrite` to write a :file:`.cdb` file containing a user-defined element, manually + insert :ref:`usrelem` and :ref:`usrdof` commands in the :file:`.cdb` file to provide the user- + defined element characteristics. Insert the two commands after the :ref:`et` command (defining the + user-defined element) and before the ``EBLOCK`` command. (If multiple element types are defined in + the :file:`.cdb` file, insert the :ref:`type` command to select the user-defined element. Place it + before :ref:`usrelem` and :ref:`usrdof`.) + + If radiosity surface elements ( ``SURF251`` or ``SURF252`` ) are present in the model, a radiosity + mapping data file, :file:`Fname.RSM,` is also saved when the :ref:`cdwrite` command is issued. For + more information, see `Advanced Radiosity Options + `_ + + *\*IGES and ANF File Formats for Solid Model Geometry Information** + + The format used for solid model geometry information is determined by the current :ref:`cdopt` + command setting. The default format is IGES. + + IGES option (default) to write solid model information ( :ref:`cdopt`, IGS): + + * Before writing solid model entities, select all corresponding lower level entities ( + :ref:`allsel`,BELOW,ALL). + + * Section properties assigned to areas, lines and other solid model entities are not maintained when + the model is exported. + + * If you issue :ref:`cdwrite` after generating a beam mesh with orientation nodes, the database file + will contain all of the nodes for every beam element, including the orientation nodes; however, + the orientation keypoints that were specified for the line ( :ref:`latt` ) are no longer + associated with the line and won't be written out to the geometry file. All associativity between + the line and the orientation keypoints is lost. + + * For beam meshing, this option does not support any line operation that relies on solid model + associativity. For example, meshing the areas adjacent to the meshed line, plotting the line that + contains the orientation nodes, or clearing the mesh from the line that contains orientation nodes + may not work as expected. + + * Concatenated lines are not written. The line segments that make up the concatenated lines are + written; however, if the command encounters an area that contains a concatenated line, the write + operation halts (that area cannot be recreated during the read operation). If your model has areas + that contain concatenated lines, you must first list these and then unconcatenate them before + issuing the :ref:`cdwrite` command. Similarly, hardpoint information cannot be written. + + ANF option to write solid model information ( :ref:`cdopt`, ANF): + + * Writes all model information in the database (regardless of select status) to the archive file; + however, when you restore the database using this archived file, the select status of entities is + also restored. + + * Restores all line attributes, including orientation keypoints. It also writes out any components + (not assemblies) that consist of solid model entities. + + * Halts :ref:`cdwrite` when a concatenated line or an area that contains a concatenated line is + detected. You must delete the concatenated lines before issuing :ref:`cdwrite`. Similarly, + hardpoint information cannot be written. + + This command is also valid in SOLUTION. + + Examples + -------- + Create a basic block and save it to disk. + + >>> mapdl.prep7() + >>> mapdl.block(0, 1, 0, 1, 0, 1) + >>> mapdl.et(1, 186) + >>> mapdl.esize(0.25) + >>> mapdl.vmesh('ALL') + >>> mapdl.cdwrite('DB', '/tmp/mesh.cdb') + TITLE = + NUMBER OF ELEMENT TYPES = 1 + 64 ELEMENTS CURRENTLY SELECTED. MAX ELEMENT NUMBER = 64 + 425 NODES CURRENTLY SELECTED. MAX NODE NUMBER = 425 + 8 KEYPOINTS CURRENTLY SELECTED. MAX KEYPOINT NUMBER = 8 + 12 LINES CURRENTLY SELECTED. MAX LINE NUMBER = 12 + 6 AREAS CURRENTLY SELECTED. MAX AREA NUMBER = 6 + 1 VOLUMES CURRENTLY SELECTED. MAX VOL. NUMBER = 1 + WRITE ANSYS DATABASE AS AN ANSYS INPUT FILE: /tmp/mesh.cdb + + Optionally load the mesh into Python using the archive reader. + + >>> from ansys.mapdl import reader as pymapdl_reader + >>> mesh = pymapdl_reader.Archive('/tmp/mesh.cdb') + >>> mesh + ANSYS Archive File mesh.cdb + Number of Nodes: 425 + Number of Elements: 64 + Number of Element Types: 1 + Number of Node Components: 0 + Number of Element Components: 0 + """ + command = f"CDWRITE,{option},'{fname}',{ext},,{fnamei},{exti},{fmat}" + return self.run(command, **kwargs) + + def cecheck(self, itemlab: str = "", tolerance: str = "", dof: str = "", **kwargs): + r"""Check constraint equations and couplings for rigid body motions. + + Mechanical APDL Command: `CECHECK `_ + + Parameters + ---------- + itemlab : str + Item indicating what is to be checked: + + * ``CE`` - Check constraint equations only + + * ``CP`` - Check couplings only + + * ``ALL`` - Check both CE and CP + + tolerance : str + Allowed amount of out-of-balance for any constraint equation or coupled set. The default value + of 1.0e-6 is usually good. + + dof : str + Specifies which DOF is to be checked. Default is RIGID, the usual option. Other choices are + individual DOF such as UX, ROTZ, etc. or THERM. The THERM option will check the constraint + equations or coupled sets for free thermal expansions, whereas the individual DOFs check under + rigid body motions. ALL is RIGID and THERM. + + Notes + ----- + + .. _CECHECK_notes: + + This command imposes a rigid body motion on the nodes attached to the constraint equation or coupled + set and makes sure that no internal forces are generated for such rigid body motions. Generation of + internal forces by rigid body motions usually indicates an error in the equation specification + (possibly due to nodal coordinate rotations). The THERM option does a similar check to see that no + internal forces are created by the equations if the body does a free thermal expansion (this check + assumes a single isotropic coefficient of expansion). + """ + command = f"CECHECK,{itemlab},{tolerance},{dof}" + return self.run(command, **kwargs) + + def check(self, sele: str = "", levl: str = "", **kwargs): + r"""Checks current database items for completeness. + + Mechanical APDL Command: `CHECK `_ + + Parameters + ---------- + sele : str + Specifies which elements are to be checked: + + * ``(blank)`` - Check all data. + + * ``ESEL`` - Check only elements in the selected set and unselect any elements not producing + geometry check messages. The remaining elements (those producing check messages) can then be + displayed and corrected. A null set results if no elements produce a message. Issue :ref:`esel`,ALL + to select all elements before proceeding. + + levl : str + Used only with ``Sele`` = ESEL: + + * ``WARN`` - Select elements producing warning and error messages. + + * ``ERR`` - Select only elements producing error messages (default). + + Notes + ----- + + .. _CHECK_notes: + + This command will not work if :ref:`shpp`,OFF has been set. A similar, automatic check of all data + is done before the solution begins. + + If the Check Elements option is invoked through the GUI (menu path Main Menu> Preprocessor> Meshing> + Check Elems ), the :ref:`check`,ESEL logic is used to highlight elements in the following way: good + elements are blue, elements having warnings are yellow, and bad (error) elements are red. The + currently selected set of elements is not changed by this GUI function. + + This command is also valid in PREP7. + """ + command = f"CHECK,{sele},{levl}" + return self.run(command, **kwargs) + + def cncheck( + self, + option: str = "", + rid1: str = "", + rid2: str = "", + rinc: str = "", + intertype: str = "", + trlevel: str = "", + val1: str = "", + val2: str = "", + val3: str = "", + **kwargs, + ): + r"""Provides and/or adjusts the initial status of contact pairs. + + Mechanical APDL Command: `CNCHECK `_ + + Parameters + ---------- + option : str + Option to be performed: + + * ``DETAIL`` - List all contact pair properties (default). + + * ``SUMMARY`` - List only the open/closed status for each contact pair. + + * ``POST`` - Execute a partial solution to write the initial contact configuration to the + :file:`jobname.rcn` file. + + * ``ADJUST`` - Physically move contact nodes to the target in order to close a gap or reduce + penetration. The initial adjustment is converted to structural displacement values (UX, UY, UZ) and + stored in the :file:`jobname.rcn` file. + + * ``MORPH`` - Physically move contact nodes to the target in order to close a gap or reduce + penetration, and also morph the underlying solid mesh. The initial adjustment of contact nodes and + repositioning of solid element nodes due to mesh morphing are converted to structural displacement + values (UX, UY, UZ) and stored in the :file:`jobname.rcn` file. + + * ``TADJUST`` - Physically move target body to the contact surface in order to close a gap or reduce + penetration. The initial adjustment is converted to structural displacement values (UX, UY, UZ) and + stored in the :file:`jobname.rcn` file. + + * ``RESET`` - Reset target element and contact element key options and real constants to their + default values. This option is not valid for general contact. + + * ``AUTO`` - Automatically sets certain real constants and key options to recommended values or + settings in order to achieve better convergence based on overall contact pair behaviors. This option + is not valid for general contact. + + * ``TRIM`` - Trim contact pair (remove certain contact and target elements). + + * ``UNSE`` - Unselect certain contact and target elements. + + * ``SPLIT`` - Split base (original) contact pairs into smaller sub-pairs at the preprocessing ( + :ref:`prep7` ) level. The main intent of this option is to achieve better scalability in a + distributed-memory parallel (DMP) run. The splitting operation may create additional overlapping + contact elements at the split boundaries. Contact pairs can only be split once; repeated use of this + option results in no further splitting for those contact pairs already split. + + * ``DMP`` - This option is similar to the SPLIT, but it is more automatic and contact pair splitting + is done at the solution level ( :ref:`solve` ) of the first load step, not at the preprocessing + level. This option is activated only in a distributed-memory parallel (DMP) run. For this option, + ``TRlevel`` and ``InterType`` are valid; all other arguments are ignored. + + * ``MERGE`` - Merge all contact sub-pairs that were previously split (by prior ``Option`` = SPLIT or + DMP operations) back to their original pairs. Any contact and target elements deleted due to the + trim logic of the splitting operation cannot be recovered by the MERGE operation. All other + arguments are ignored. + + rid1 : str + The meanings of ``RID1``, ``RID2``, and ``RINC`` vary depending on the contact type or the + ``Option`` specified, as described below. ``RID1`` accepts tabular input for some ``Option`` values. + ``RID1``, ``RID2``, ``RINC`` are ignored when ``Option`` = DMP. + + Pair-Based Contact For pair-based contact, the range of real constant pair IDs for which ``Option`` will be performed. + If ``RID2`` is not specified, it defaults to ``RID1``. If no value is specified, all contact pairs + in the selected set of elements are considered. + + General Contact For general contact ( ``InterType`` = GCN), ``RID1`` and ``RID2`` are section IDs associated with + general contact surfaces instead of real constant IDs. If ``RINC`` = 0, the ``Option`` is performed + between the two sections, ``RID1`` and ``RID2``. If ``RINC >`` 0, the ``Option`` is performed among + all specified sections ( ``RID1`` to ``RID2`` with increment of ``RINC`` ). + + Contact Splitting For contact splitting at the preprocessing level ( ``Option`` = SPLIT only), ``RID1``, ``RID2``, and ``RINC`` are used as follows: + + * If ``RID1``, ``RID2``, and ``RINC`` are non-zero and positive, split the contact pairs from real + constant pair ID number ``RID1`` to ``RID2`` in increments of ``RINC``. In this case, if + ``TRlevel`` is non-zero, it will only be applied to these specified pairs. + + * If ``RID1`` is zero or blank, ``TRlevel`` will take affect for all contact pairs in the model from + largest to smallest. + + * If ``RID1``, ``RID2``, ``RINC``, and ``TRlevel`` are not defined, the program automatically + determines the number of sub-pairs for splitting each contact pair. + + Tabular Input for ``RID1`` ``RID1`` accepts tabular input in the form of a 2D array when ``Option`` = ADJUST, MORPH or TADJUST. + In this case, ``RID2``, ``RINC``, ``Val1``, ``Val2``, and ``Val3`` are ignored. For more + information, see `Physically Moving Contact Nodes Toward the Target Surface + `_ + + rid2 : str + The meanings of ``RID1``, ``RID2``, and ``RINC`` vary depending on the contact type or the + ``Option`` specified, as described below. ``RID1`` accepts tabular input for some ``Option`` values. + ``RID1``, ``RID2``, ``RINC`` are ignored when ``Option`` = DMP. + + Pair-Based Contact For pair-based contact, the range of real constant pair IDs for which ``Option`` will be performed. + If ``RID2`` is not specified, it defaults to ``RID1``. If no value is specified, all contact pairs + in the selected set of elements are considered. + + General Contact For general contact ( ``InterType`` = GCN), ``RID1`` and ``RID2`` are section IDs associated with + general contact surfaces instead of real constant IDs. If ``RINC`` = 0, the ``Option`` is performed + between the two sections, ``RID1`` and ``RID2``. If ``RINC >`` 0, the ``Option`` is performed among + all specified sections ( ``RID1`` to ``RID2`` with increment of ``RINC`` ). + + Contact Splitting For contact splitting at the preprocessing level ( ``Option`` = SPLIT only), ``RID1``, ``RID2``, and ``RINC`` are used as follows: + + * If ``RID1``, ``RID2``, and ``RINC`` are non-zero and positive, split the contact pairs from real + constant pair ID number ``RID1`` to ``RID2`` in increments of ``RINC``. In this case, if + ``TRlevel`` is non-zero, it will only be applied to these specified pairs. + + * If ``RID1`` is zero or blank, ``TRlevel`` will take affect for all contact pairs in the model from + largest to smallest. + + * If ``RID1``, ``RID2``, ``RINC``, and ``TRlevel`` are not defined, the program automatically + determines the number of sub-pairs for splitting each contact pair. + + Tabular Input for ``RID1`` ``RID1`` accepts tabular input in the form of a 2D array when ``Option`` = ADJUST, MORPH or TADJUST. + In this case, ``RID2``, ``RINC``, ``Val1``, ``Val2``, and ``Val3`` are ignored. For more + information, see `Physically Moving Contact Nodes Toward the Target Surface + `_ + + rinc : str + The meanings of ``RID1``, ``RID2``, and ``RINC`` vary depending on the contact type or the + ``Option`` specified, as described below. ``RID1`` accepts tabular input for some ``Option`` values. + ``RID1``, ``RID2``, ``RINC`` are ignored when ``Option`` = DMP. + + Pair-Based Contact For pair-based contact, the range of real constant pair IDs for which ``Option`` will be performed. + If ``RID2`` is not specified, it defaults to ``RID1``. If no value is specified, all contact pairs + in the selected set of elements are considered. + + General Contact For general contact ( ``InterType`` = GCN), ``RID1`` and ``RID2`` are section IDs associated with + general contact surfaces instead of real constant IDs. If ``RINC`` = 0, the ``Option`` is performed + between the two sections, ``RID1`` and ``RID2``. If ``RINC >`` 0, the ``Option`` is performed among + all specified sections ( ``RID1`` to ``RID2`` with increment of ``RINC`` ). + + Contact Splitting For contact splitting at the preprocessing level ( ``Option`` = SPLIT only), ``RID1``, ``RID2``, and ``RINC`` are used as follows: + + * If ``RID1``, ``RID2``, and ``RINC`` are non-zero and positive, split the contact pairs from real + constant pair ID number ``RID1`` to ``RID2`` in increments of ``RINC``. In this case, if + ``TRlevel`` is non-zero, it will only be applied to these specified pairs. + + * If ``RID1`` is zero or blank, ``TRlevel`` will take affect for all contact pairs in the model from + largest to smallest. + + * If ``RID1``, ``RID2``, ``RINC``, and ``TRlevel`` are not defined, the program automatically + determines the number of sub-pairs for splitting each contact pair. + + Tabular Input for ``RID1`` ``RID1`` accepts tabular input in the form of a 2D array when ``Option`` = ADJUST, MORPH or TADJUST. + In this case, ``RID2``, ``RINC``, ``Val1``, ``Val2``, and ``Val3`` are ignored. For more + information, see `Physically Moving Contact Nodes Toward the Target Surface + `_ + + intertype : str + The type of contact interface ( `pair-based versus general contact + `_ + ) to be considered; or the type of contact pair to be trimmed/unselected/auto-set. + + The following labels specify the type of contact interface: + + * ``(blank)`` - Include all contact definitions (pair-based and general contact). + + * ``GCN`` - Include general contact definitions only (not valid when ``Option`` = RESET or AUTO). + + The following labels specify the type of contact pairs to be trimmed/unselected/auto-set (used only + when ``Option`` = TRIM, UNSE, or AUTO, and only for pair-based contact definitions): + + * ``ANY`` - All types (default). + + * ``MPC`` - MPC-based contact pairs (KEYOPT(2) = 2). + + * ``BOND`` - Bonded contact pairs (KEYOPT(12) = 3, 5, 6). + + * ``NOSP`` - No separation contact pairs (KEYOPT(12) = 2, 4). + + * ``SMAL`` - Small sliding contact pairs (KEYOPT(18) = 1). + + * ``SELF`` - Self contact pairs (target surface completely overlaps contact surface). + + * ``INAC`` - Inactive contact pairs (symmetric contact pairs for MPC contact or KEYOPT(8) = 2). + + The following labels specify the type of contact pairs to be trimmed only when ``Option`` = SPLIT or DMP, and only for pair-based contact definitions: + + * ``(blank)`` - The program automatically deletes inactive contact pairs defined by auto-asymmetric + selection (KEYOPT(8) = 2). If ``Option`` = DMP, the program also trims split contact pairs that are + associated with bonded contact (KEYOPT(12) = 5 or 6) or small sliding contact (KEYOPT(18) = 1). + + * ``TRIM`` - The program automatically deletes inactive contact pairs defined by auto-asymmetric + selection (KEYOPT(8) = 2), and also trims all split contact pairs. + + trlevel : str + This argument is either the trimming level for trimming contact pairs or the number of sub-pairs for + contact splitting. + + Trimming level (used only when ``Option`` = TRIM, UNSE, or MORPH): + + * ``(blank)`` - Normal trimming (default): remove/unselect contact and target elements which are in + far-field. + + * ``AGGRE`` - Aggressive trimming: remove/unselect contact and target elements which are in far- + field, and certain elements in near-field. + + Number of sub-pairs used for contact splitting (used only when ``Option`` = SPLIT or DMP): + + * ``(blank)`` - The program automatically chooses the number of sub-pairs for splitting in order to + achieve better scalability in a DMP run. + + * ``N`` - Input a non-zero positive number to indicate the maximum number of sub-pairs for splitting + the largest contact pair in the model. All other smaller contact pairs will be split following this + number proportionally. The number you input may not always be honored; splitting may results in a + fewer number of sub-pairs basing on many factors + + val1 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for + further information. + + val2 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for + further information. + + val3 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for + further information. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + .. _CNCHECK_notes: + + The :ref:`cncheck` command provides information for surface-to-surface, node-to-surface, and line- + to-line contact pairs (element types ``TARGE169``, ``TARGE170``, ``CONTA172``, ``CONTA174``, + ``CONTA175``, ``CONTA177`` ). All contact and target elements of interest, along with the solid + elements and nodes attached to them, must be selected for the command to function properly. For + performance reasons, the program uses a subset of nodes and elements based on the specified contact + regions ( ``RID1``, ``RID2``, ``RINC`` ) when executing the :ref:`cncheck` command. + + :ref:`cncheck` is available in both the PREP7 and SOLUTION processors, but only before the first + solve operation (that is, only before the first load step or the first substep). + + If the contact and target elements were generated through mesh commands ( :ref:`amesh`, + :ref:`lmesh`, etc.) instead of the :ref:`esurf` command, you must issue :ref:`modmsh`,DETACH before + :ref:`cncheck`. Otherwise, :ref:`cncheck` will not work correctly. + + The following additional notes are available: + + The command :ref:`cncheck`,POST solves the initial contact configuration in one substep. After + issuing this command, you can postprocess the contact result items as you would for any other + converged load step; however, only the contact status, contact penetration or gap, and contact + pressure will have meaningful values. Other contact quantities (friction stress, sliding distance, + chattering) will be available but are not useful. + + In order to report the real geometric penetration and gap, the program internally sets KEYOPT(9) = 0 + during the execution of :ref:`cncheck`,POST. + + Because ``Option`` = POST forces a solve operation, the PrepPost (PP) license does not work with + :ref:`cncheck`,POST. + + If :ref:`cncheck`,POST is issued within the solution processor, the :ref:`solve` command that solves + the first load step of your analysis should appear in a different step, as shown in the following + example: + + .. code:: apdl + + /SOLU + CNCHECK,POST + FINISH + ... + + /SOLU + SOLVE + FINISH + ... + + :ref:`cncheck`,POST writes initial contact results to a file named :file:`jobname.rcn`. When + postprocessing the initial contact state, you need to explicitly read results from this file using + the :ref:`file` and :ref:`set`,FIRST commands in POST1 to properly read the corresponding contact + data. Otherwise, the results may be read improperly. The following example shows a valid command + sequence for plotting the initial contact gap: + + .. code:: apdl + + /SOLU + CNCHECK,POST + FINISH + /POST1 + FILE,Jobname,RCN + SET,FIRST + PLNSOL,CONT,GAP,0,1 + FINISH + ... + + You can issue :ref:`cncheck`,ADJUST to physically move contact nodes to the target surface. + Alternatively, you can issue :ref:`cncheck`,MORPH to physically move contact nodes to the target + surface and then morph the underlying mesh to improve the mesh quality. See `Physically Moving + Contact Nodes Toward the Target Surface + `_ + :ref:`cncheck`,ADJUST or :ref:`cncheck`,MORPH is issued within the solution processor, the + :ref:`solve` command that solves the first load step of your analysis should appear in a different + step: + + .. code:: apdl + + /SOLU + CNCHECK,ADJUST + FINISH + ... + + /SOLU + SOLVE + FINISH + ... + + After issuing the :ref:`cncheck`,ADJUST command, the initial adjustment is converted to structural + displacement values (UX, UY, UZ) and stored in a file named :file:`jobname.rcn`. Similarly, the + :ref:`cncheck`,MORPH command converts the initial adjustment of contact nodes as well as the + morphing adjustment of solid element nodes to structural displacement values (UX, UY, UZ) and stores + them in the :file:`jobname.rcn` file. You can use this file to plot or list nodal adjustment vectors + or create a contour plot of the adjustment magnitudes via the displacements. When postprocessing the + nodal adjustment values, you need to explicitly read results from this file using the :ref:`file` + and :ref:`set`,FIRST commands in POST1 to properly read the corresponding contact data. Otherwise, + the results may be read improperly. + + The :file:`jobname.rcn` file contains information generated from the :ref:`cncheck`,POST, + :ref:`cncheck`,ADJUST, :ref:`cncheck`,MORPH, or :ref:`cncheck`, TADJUST command. If multiple + commands are issued in the same analysis, the file is overwritten by the last :ref:`cncheck` + command. + + You can issue :ref:`cncheck`,TADJUST to physically move the target body to the contact surface. This + command tries to establish initial contact with penetration in a range specified by ``PMAX`` and + ``PMIN``. Similar to the ADJUST and MORPH options, the initial adjustment is converted to structural + displacement values (UX, UY, UZ) and stored in the :file:`jobname.rcn` file. This option accepts + tabular input in the ``RID1`` field. + + You can specify either a positive or negative value for ``PMIN`` and ``PMAX``. The program + interprets a positive value as a scaling factor and interprets a negative value as the absolute + value. + + For more information, see `Physically Moving the Target Body Toward the Contact Surface + `_ + + The command :ref:`cncheck`,RESET allows you to reset all but a few key options and real constants + associated with the specified contact pairs ( ``RID1``, ``RID2``, ``RINC`` ) to their default + values. This option is only valid for pair-based contact definitions. + + The following key options and real constants remain unchanged when this command is issued: + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + The command :ref:`cncheck`,AUTO automatically changes certain default or undefined key options and + real constants to optimized settings or values. The changes are based on overall contact pair + behaviors. In general, this command improves convergence for nonlinear contact analysis. This option + is only valid for pair-based contact definitions. + + The tables below list typical KEYOPT and real constant settings implemented by :ref:`cncheck`,AUTO. + The actual settings implemented for your specific model may vary from what is described here. You + should always verify the modified settings by issuing :ref:`cncheck`,DETAIL to list current contact + pair properties. + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + .. _AUTO_keyopts_ft_1: + + Set to 0 if KEYOPT(2) > 1 for debonding. + + .. _AUTO_keyopts_ft_2: + + Set to 1 if underlying elements are superelements, or if KEYOPT(9) = 2 was previously specified. + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + .. _AUTO_real_ft_1: + + PINB default depends on contact behavior (rigid vs. flexible target), :ref:`nlgeom`,ON or OFF, + KEYOPT(9) setting, KEYOPT(12) setting, and the value of real constant CNOF (see ). + + :ref:`cncheck`,AUTO also sets :ref:`pred`,OFF for the case of a `force-distributed constraint + `_ + defined via `MPC contact + `_. + + You can issue :ref:`cncheck`,TRIM or :ref:`cncheck`,UNSEL to remove or unselect contact and target + elements which are in far-field (that is, open and not near contact), or even in near-field if + aggressive trimming logic is used ( ``TRlevel`` = AGGRE). + + The SPLIT, DMP, and MERGE options are intended for use in a distributed-memory parallel (DMP) run. + Use the command :ref:`cncheck`,SPLIT or :ref:`cncheck`,DMP to split large contact pairs into + smaller sub-pairs so that the smaller contact pairs can be distributed into different cores, thereby + improving performance. This functionality is not the same as manually splitting contact pairs during + the modeling process. The program splitting logic performs the necessary exchange of data on the + boundaries between the split contact pairs to ensure that the results with and without splitting are + essentially identical. + + The command :ref:`cncheck`,MERGE can be used to merge the sub-pairs together again, which is useful + for postprocessing the contact results based on the original contact pair geometry. However, caution + must be taken when a downstream analysis is performed since the MERGE operation may alter the + database. + + For more information, see `Solving Large Contact Models in a Distributed-Memory Parallel Environment + `_ + """ + command = f"CNCHECK,{option},{rid1},{rid2},{rinc},{intertype},{trlevel},{val1},{val2},{val3}" + return self.run(command, **kwargs) + + def escheck(self, sele: str = "", levl: str = "", defkey: int | str = "", **kwargs): + r"""Perform element shape checking for a selected element set. + + Mechanical APDL Command: `ESCHECK `_ + + Parameters + ---------- + sele : str + Specifies whether to select elements for checking: + + * ``(blank)`` - List all warnings/errors from element shape checking. + + * ``ESEL`` - Select the elements based on the. ``Levl`` criteria specified below. + + levl : str + + * ``WARN`` - Select elements producing warning and error messages. + + * ``ERR`` - Select only elements producing error messages (default). + + defkey : int or str + Specifies whether check should be performed on deformed element shapes. + + * ``0`` - Do not update node coordinates before performing shape checks (default). + + * ``1`` - Update node coordinates using the current set of deformations in the database. + + Notes + ----- + + .. _ESCHECK_notes: + + Shape checking will occur according to the current :ref:`shpp` settings. Although :ref:`escheck` is + valid in all processors, ``Defkey`` uses the current results in the database. If no results are + available a warning will be issued. + + This command is also valid in PREP7, SOLUTION and POST1. + """ + command = f"ESCHECK,{sele},{levl},{defkey}" + return self.run(command, **kwargs) + + def igesout(self, fname: str = "", ext: str = "", att: int | str = "", **kwargs): + r"""Writes solid model data to a file in IGES Version 5.1 format. + + Mechanical APDL Command: `IGESOUT `_ + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to IGES if ``Fname`` is + blank. + + att : int or str + Attribute key: + + * ``0`` - Do not write assigned numbers and attributes of the solid model entities to the IGES file + (default). + + * ``1`` - Write assigned numbers and attributes of solid model entities (keypoints, lines, areas, + volumes) to the IGES file. Attributes include MAT, TYPE, REAL, and ESYS specifications as well as + associated solid model loads and meshing (keypoint element size, number of line divisions and + spacing ratio) specifications. + + Notes + ----- + + .. _IGESOUT_notes: + + Causes the selected solid model data to be written to a coded file in the IGES Version 5.1 format. + Previous data on this file, if any, are overwritten. + + Keypoints that are not attached to any line are written to the output file as IGES entity 116 + (Point). + + Lines that are not attached to any area are written to the output file as either IGES Entity 100 + (Circular Arc), 110 (Line), or 126 (Rational B-Spline Curve) depending upon whether the Mechanical + APDL + entity was defined as an arc, straight line, or spline. + + Areas are written to the output file as IGES Entity 144 (Trimmed Parametric Surface). + + Volumes are written to the output file as IGES entity 186 (Manifold Solid B-Rep Object). + + Solid model entities to be written must have all corresponding lower level entities selected (use + :ref:`allsel`,BELOW,ALL) before issuing command. + + Concatenated lines and areas are not written to the IGES file; however, the entities that comprise + the concatenated entities are written. + + .. warning:: + + Section properties assigned to areas, lines and other solid model entities are not maintained + when the model is exported via IGESOUT. Issuing IGESOUT after generating a beam mesh with + orientation nodes causes the orientation keypoints specified for the line ( LATT ) to no longer + be associated with the line and are therefore not written out to the IGES file. The line does + not recognize that orientation keypoints were ever assigned to it. Therefore, IGESOUT does not + support (for beam meshing) any line operation relying on solid model associativity. (For + example, meshing the areas adjacent to the meshed line, plotting the line that contains the + orientation nodes, or clearing the mesh from the line that contains orientation nodes may not + work as expected.) For more information about beam meshing, see Meshing Your Solid Model. + """ + command = f"IGESOUT,{fname},{ext},,{att}" + return self.run(command, **kwargs) + + def nooffset(self, label: str = "", **kwargs): + r"""Prevents the :ref:`cdread` command from offsetting specified data items + + Mechanical APDL Command: `NOOFFSET `_ + + Parameters + ---------- + label : str + Specifies items not to be offset. + + * ``NODE`` - Node numbers + + * ``ELEM`` - Element numbers + + * ``KP`` - Keypoint numbers + + * ``LINE`` - Line numbers + + * ``AREA`` - Area numbers + + * ``VOLU`` - Volume numbers + + * ``MAT`` - Material numbers + + * ``TYPE`` - Element type numbers + + * ``REAL`` - Real constant numbers + + * ``CSYS`` - Coordinate system numbers + + * ``SECN`` - Section numbers + + * ``CP`` - Coupled set numbers + + * ``CE`` - Constraint equation numbers + + * ``CLEAR`` - All items will be offset + + * ``STATUS`` - Shows which items are specified not to be offset. + + Notes + ----- + + .. _NOOFFSET_notes: + + The :ref:`nooffset` command specifies data items not to be offset by a set of data read from a + :ref:`cdread` command. + """ + command = f"NOOFFSET,{label}" + return self.run(command, **kwargs) + + def numcmp(self, label: str = "", **kwargs): + r"""Compresses the numbering of defined items. + + Mechanical APDL Command: `NUMCMP `_ + + Parameters + ---------- + label : str + Items to be compressed: + + * ``NODE`` - Node numbers + + * ``ELEM`` - Element numbers + + * ``KP`` - Keypoint numbers + + * ``LINE`` - Line numbers + + * ``AREA`` - Area numbers + + * ``VOLU`` - Volume numbers + + * ``MAT`` - Material numbers + + * ``TYPE`` - Element type numbers + + * ``REAL`` - Real constant numbers + + * ``CP`` - Coupled set numbers + + * ``SECN`` - Section numbers + + * ``CE`` - Constraint equation numbers + + * ``CSYS`` - Coordinate system numbers + + * ``ALL`` - All item numbers + + Notes + ----- + + .. _NUMCMP_notes: + + The :ref:`numcmp` command effectively compresses out unused item numbers by renumbering all the + items, beginning with one and continuing throughout the model. The renumbering order follows the + initial item numbering order (that is, compression lowers the maximum number by "sliding" numbers + down to take advantage of unused or skipped numbers). All defined items are renumbered, regardless + of whether or not they are actually used or selected. Applicable related items are also checked for + renumbering as described for the merge operation ( :ref:`nummrg` ). + + Compressing material numbers ( :ref:`numcmp`,ALL or :ref:`numcmp`,MAT) does not update the material + number referenced by either of the following: + + * A temperature-dependent convection or surface-to-surface radiation load ( :ref:`sf`, :ref:`sfe`, + :ref:`sfl`, :ref:`sfa` ) + + * Real constants for multi-material elements + + Compression is usually not required unless memory space is limited and there are large gaps in the + numbering sequence. + """ + command = f"NUMCMP,{label}" + return self.run(command, **kwargs) + + def nummrg( + self, + label: str = "", + toler: str = "", + gtoler: str = "", + action: str = "", + switch: str = "", + **kwargs, + ): + r"""Merges coincident or equivalently defined items. + + Mechanical APDL Command: `NUMMRG `_ + + Parameters + ---------- + label : str + Items to be merged: + + * ``NODE`` - Nodes + + * ``ELEM`` - Elements + + * ``KP`` - Keypoints (will also merge lines, areas, and volumes) + + * ``MAT`` - Materials + + * ``TYPE`` - Element types + + * ``REAL`` - Real constants + + * ``SECT`` - Section types + + * ``CP`` - Coupled sets + + * ``CE`` - Constraint equations + + * ``ALL`` - All items + + toler : str + Range of coincidence. For ``Label`` = NODE and KP, defaults to 1.0E-4 (based on maximum + Cartesian coordinate difference between nodes or keypoints). For ``Label`` = MAT, REAL, SECT, + and CE, defaults to 1.0E-7 (based on difference of the values normalized by the values). Only + items within range are merged. (For keypoints attached to lines, further restrictions apply. See + the ``GTOLER`` field and Merging Solid Model Entities below.) + + gtoler : str + Global solid model tolerance -- used only when merging keypoints attached to lines. If + specified, ``GTOLER`` will override the internal relative solid model tolerance. See Merging + Solid Model Entities below. + + action : str + Specifies whether to merge or select coincident items. + + * ``SELE`` - Select coincident items but do not merge. ``Action`` = SELE is only valid for ``Label`` + = NODE. + + * ``(Blank)`` - Merge the coincident items (default). + + switch : str + Specifies whether the lowest or highest numbered coincident item is retained after the merging + operation. This option does not apply to keypoints; that is, for ``Label`` = KP, the lowest numbered keypoint is retained regardless of the ``Switch`` setting. + + * ``LOW`` - Retain the lowest numbered coincident item after the merging operation (default). + + * ``HIGH`` - Retain the highest numbered coincident item after the merging operation. + + Notes + ----- + + .. _NUMMRG_notes: + + The :ref:`nummrg` command does not change a model's geometry, only the topology. + + After issuing the command, the area and volume sizes ( :ref:`asum` and :ref:`vsum` ) may give + slightly different results. In order to obtain the same results as before, use :ref:`facet`, + :ref:`normal`, and :ref:`asum` / :ref:`vsum`. + + The merge operation is useful for tying separate but coincident parts of a model together. If not + all items are to be checked for merging, use the select commands ( :ref:`nsel`, :ref:`esel`, etc.) + to select items. Only selected items are included in the merge operation for nodes, keypoints, and + elements. + + By default, the merge operation retains the lowest numbered coincident item. Higher numbered + coincident items are deleted. Set ``Switch`` to HIGH to retain the highest numbered coincident item + after the merging operation. Applicable related items are also checked for deleted item numbers and + if found, are replaced with the retained item number. For example, if nodes are merged, element + connectivities (except superelements), mesh item range associativity, coupled degrees of freedom, + constraint equations, master degrees of freedom, degree of freedom constraints, nodal-force loads, + nodal surface loads, and nodal body force loads are checked. Merging material numbers ( + :ref:`nummrg`,ALL or :ref:`nummrg`,MAT) does not update the material number referenced: + + * By temperature-dependent film coefficients as part of convection load or a temperature-dependent + emissivity as part of a surface-to-surface radiation load ( :ref:`sf`, :ref:`sfe`, :ref:`sfl`, + :ref:`sfa` ) + + * By real constants for multi-material elements + + When merging tapered beam or pipe sections, the program first uses the associated end sections for + merging. If the merge is successful, the program replaces the tapered section database with the end + section data. + + If a unique load is defined among merged nodes, the value is kept and applied to the retained node. + If loads are not unique (not recommended), only the value on the lowest node (or highest if + ``Switch`` = HIGH) is kept (except for "force" loads for which the values are summed if they are not + defined via tabular boundary conditions). + + The unused nodes (not recommended) in elements, couplings, constraint equations, etc. may become + active after the merge operation. + + The ``Action`` field provides the option of visualizing the coincident items before the merging + operation. + + .. warning:: + + When merging entities in a model that has already been meshed, the order in which you issue + multiple NUMMRG commands is significant. To merge two adjacent meshed regions having coincident + nodes and keypoints, always merge nodes ( NUMMRG,NODE) beforemerging keypoints ( NUMMRG,KP); + otherwise, some of the nodes may lose their association with the solid model (causing other + operations to fail). To prevent mesh failure, avoid multiple merging and meshing operations. + + After a :ref:`nummrg`,NODE command executes, some nodes may be attached to more than one solid + entity. As a result, subsequent attempts to transfer solid model loads to the elements may not be + successful. Issue :ref:`nummrg`,KP to correct this problem. Do NOT issue :ref:`vclear` before + issuing :ref:`nummrg`,KP. + + For :ref:`nummrg`,ELEM, elements must be identical in all aspects, including the direction of the + element coordinate system. + + For certain solid and shell elements, the program interprets coincident faces as internal and + eliminate them. To prevent this from occurring, shrink the entities by a very small factor to + delineate coincident items ( :ref:`shrink`, 0.0001) and no internal nodes, lines, areas or elements + will be eliminated. + + When working with solid models, you may have better success with the gluing operations ( + :ref:`aglue`, :ref:`lglue`, :ref:`vglue` ). Please read the following information when attempting to + merge solid model entities. + + Gluing Operations vs. Merging Operations + + Adjacent, touching regions can be joined by gluing them ( :ref:`aglue`, :ref:`lglue`, :ref:`vglue` ) + or by merging coincident keypoints ( :ref:`nummrg`,KP, which also causes merging of identical lines, + areas, and volumes). In many situations, either approach will work just fine. Some factors, however, + may lead to a preference for one method over the other. + + **Geometric Configuration** + + Gluing is possible regardless of the initial alignment or offset of the input entities. Keypoint + merging is possible only if each keypoint on one side of the face to be joined is matched by a + coincident keypoint on the other side. This is commonly the case after a symmetry reflection ( + :ref:`arsym` or :ref:`vsymm` ) or a copy ( :ref:`agen` or :ref:`vgen` ), especially for a model + built entirely in Mechanical APDL rather than imported from a CAD system. When the geometry is + extremely + precise, and the configuration is correct for keypoint merging, :ref:`nummrg` is more efficient and + robust than :ref:`aglue` or :ref:`vglue`. + + **Model Accuracy** + + As with all boolean operations, gluing requires that the input entities meet the current boolean + tolerance (BTOL). Otherwise, :ref:`aglue` or :ref:`vglue` may fail. In such cases, relaxing the + tolerance may allow the glue to complete. An advantage of gluing is that it is unlikely to degrade + the accuracy of a geometric model. Keypoint merging can operate on almost any combination of + entities (although you may have to override the default tolerances on :ref:`nummrg` ). However, it + can also introduce or increase accuracy flaws, making later boolean operations less likely to + succeed. If the input tolerances are too large, :ref:`nummrg` can collapse out small lines, areas, + or volumes you intended to keep, possibly rendering the model unusable. + + **Mesh Status** + + As with all boolean operations, gluing requires that the input entities be unmeshed. Keypoint + merging is effective for meshed models under the right conditions. More information on keypoint + merging follows. + + Merging Solid Model Entities: + + When merging solid model entities ( ``Label`` = KP or ALL), keypoint locations are used as the basis + for merging. Once keypoints are merged, any higher order solid model entities (lines, areas, and + volumes), regardless of their select status or attachment to the merged keypoints, are considered + for merging. + + Keypoints that are attached to lines will be merged only if: + + * ΔX, ΔY, and ΔZ are each less than ``TOLER`` + + where, + + * ΔX is the X component of the distance between keypoints, * ΔY is the Y component of the distance + between keypoints, and * ΔZ is the Z component of the distance between keypoints; + + and + + * :math:`equation not available` is less than 1E-5 times the length of the longest line attached to + those keypoints (internal relative solid model tolerance), or :math:`equation not available` + is less than ``GTOLER`` (global solid model tolerance) if specified. + + The ``TOLER`` field is a consideration tolerance. If a keypoint is within ``TOLER`` of another + keypoint, then those two keypoints are candidates to be merged. If, when "moving" the higher + numbered keypoint, the distance exceeds the internal relative solid model tolerance, or the global + solid model tolerance ( ``GTOLER`` ) if specified, the keypoints will not be merged. Lines, areas, + and volumes are considered for merging in a similar manner. + + The internal relative solid model tolerance should be overridden by the global solid model tolerance + ( ``GTOLER`` ) only when absolutely necessary. ``GTOLER`` is an absolute tolerance; if specified, + relative lengths of lines in the model will no longer be considered in the merge operation. If + ``GTOLER`` is too large, you can "merge-out" portions of your model accidently, effectively + defeaturing the model. If using ``GTOLER``, it is good practice so first save the database before + issuing :ref:`nummrg` (as undesired merges of solid model entities could occur). + """ + command = f"NUMMRG,{label},{toler},{gtoler},{action},{switch}" + return self.run(command, **kwargs) + + def numoff(self, label: str = "", value: str = "", kref: str = "", **kwargs): + r"""Adds a number offset to defined items. + + Mechanical APDL Command: `NUMOFF `_ + + Parameters + ---------- + label : str + Apply offset number to one of the following sets of items: + + * ``NODE`` - Nodes + + * ``ELEM`` - Elements + + * ``KP`` - Keypoints + + * ``LINE`` - Lines + + * ``AREA`` - Areas + + * ``VOLU`` - Volumes + + * ``MAT`` - Materials + + * ``TYPE`` - Element types + + * ``REAL`` - Real constants + + * ``CP`` - Coupled sets + + * ``SECN`` - Section numbers + + * ``CE`` - Constraint equations + + * ``CSYS`` - Coordinate systems + + value : str + Offset number value (cannot be negative) + + kref : str + Attribute reference key: + + 0 - Add number offset to defined items only (default) + + 1 - Add number offset to all attribute references (includes undefined items) + + Notes + ----- + + .. _NUMOFF_notes: + + Useful for offsetting current model data to prevent overlap if another model is read in. + :ref:`cdwrite` automatically writes the appropriate :ref:`numoff` commands followed by the model + data to :file:`File.CDB`. When the file is read, therefore, any model already existing in the + database is offset before the model data on the file is read. + + Offsetting material numbers with this command ( :ref:`numoff`,MAT) does not update the material + number referenced by either of the following: + + * A temperature-dependent convection or surface-to-surface radiation load ( :ref:`sf`, :ref:`sfe`, + :ref:`sfl`, :ref:`sfa` ) + + * Real constants for multi-material elements + + A mismatch may therefore exist between the material definitions and the material numbers referenced. + """ + command = f"NUMOFF,{label},{value},{kref}" + return self.run(command, **kwargs) + + def numstr(self, label: str = "", value: str = "", **kwargs): + r"""Establishes starting numbers for automatically numbered items. + + Mechanical APDL Command: `NUMSTR `_ + + Parameters + ---------- + label : str + Apply starting number to one of the following sets of items: + + * ``NODE`` - Node numbers. ``Value`` defaults (and is continually reset) to 1 + maximum node number + in model. Cannot be reset lower. + + * ``ELEM`` - Element numbers. ``Value`` defaults (and is continually reset) to 1 + maximum element + number in model. Cannot be reset lower. + + * ``KP`` - Keypoint numbers. ``Value`` defaults to 1. Only undefined numbers are used. Existing + keypoints are not overwritten. + + * ``LINE`` - Line numbers. ``Value`` defaults to 1. Only undefined numbers are used. Existing lines + are not overwritten. + + * ``AREA`` - Area numbers. ``Value`` defaults to 1. Only undefined numbers are used. Existing areas + are not overwritten. + + * ``VOLU`` - Volume numbers. ``Value`` defaults to 1. Only undefined numbers are used. Existing + volumes are not overwritten. + + * ``DEFA`` - Default. Returns all starting numbers to their default values. + + value : str + Starting number value. + + Notes + ----- + + .. _NUMSTR_notes: + + Establishes starting numbers for various items that may have numbers automatically assigned (such as + element numbers with the :ref:`egen` command, and node and solid model entity numbers with the mesh + like :ref:`amesh`, :ref:`vmesh`, etc.. Use :ref:`numstr`,STAT to display settings. Use + :ref:`numstr`,DEFA to reset all specifications back to defaults. Defaults may be lowered by + deleting and compressing items (that is, :ref:`ndele` and :ref:`numcmp`,NODE for nodes, etc.). + + A mesh clear operation ( :ref:`vclear`, :ref:`aclear`, :ref:`lclear`, and :ref:`kclear` ) + automatically sets starting node and element numbers to the highest unused numbers. If a specific + starting node or element number is desired, issue :ref:`numstr` after the clear operation. + """ + command = f"NUMSTR,{label},{value}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/prep7/element_type.py b/src/ansys/mapdl/core/_commands/prep7/element_type.py new file mode 100644 index 00000000000..0b73b2c6754 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/element_type.py @@ -0,0 +1,481 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from ansys.mapdl.core._commands import parse + + +class ElementType: + + def dof( + self, + lab1: str = "", + lab2: str = "", + lab3: str = "", + lab4: str = "", + lab5: str = "", + lab6: str = "", + lab7: str = "", + lab8: str = "", + lab9: str = "", + lab10: str = "", + **kwargs, + ): + r"""Adds degrees of freedom to the current DOF set. + + Mechanical APDL Command: `DOF `_ + + **Command default:** + + .. _DOF_default: + + Use degree of freedom set determined from element types. + + Parameters + ---------- + lab1 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab2 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab3 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab4 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab5 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab6 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab7 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab8 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab9 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + lab10 : str + Valid labels are: UX, UY, UZ (structural displacements); ROTX, ROTY, ROTZ (structural + rotations); TEMP, TBOT, TE2, TE3,..., TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG + (magnetic scalar potential); AZ (magnetic vector potential); CURR (current); EMF (electromotive + force drop); CONC (concentration); DELETE. + + Notes + ----- + + .. _DOF_notes: + + The degree of freedom (DOF) set for the model is determined from all element types defined. This + command may be used to add to the current set. The ALL label may be used on some commands to + represent all labels of the current degree of freedom set for the model. Issue the :ref:`dof` + command with no arguments to list the current set. Use the DELETE label to delete any previously + added DOFs and return to the default DOF set. + + **Product Restrictions** + + .. _DOFprodRest: + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + """ + command = f"DOF,{lab1},{lab2},{lab3},{lab4},{lab5},{lab6},{lab7},{lab8},{lab9},{lab10}" + return self.run(command, **kwargs) + + def et( + self, + itype: str = "", + ename: str = "", + kop1: str = "", + kop2: str = "", + kop3: str = "", + kop4: str = "", + kop5: str = "", + kop6: str = "", + inopr: str = "", + **kwargs, + ): + r"""Defines a local element type from the element library. + + Mechanical APDL Command: `ET `_ + + Parameters + ---------- + itype : str + An arbitrary local element-type number. Defaults to 1 + current maximum. + + ename : str + A full element name (such as + + .. code:: apdl + + pipe288 + + ) or element number only (such as + + .. code:: apdl + + 288 + + ), as given in the `element library + `_. + + kop1 : str + KEYOPT values (1 through 6) as desired for the specified element. + + kop2 : str + KEYOPT values (1 through 6) as desired for the specified element. + + kop3 : str + KEYOPT values (1 through 6) as desired for the specified element. + + kop4 : str + KEYOPT values (1 through 6) as desired for the specified element. + + kop5 : str + KEYOPT values (1 through 6) as desired for the specified element. + + kop6 : str + KEYOPT values (1 through 6) as desired for the specified element. + + inopr : str + Specify 1 to suppress all element-solution printout for this element type. + + Notes + ----- + The ET command selects an element type from the element + library and establishes it as a local element type for the + current model. Information derived from the element type is + used for subsequent commands, so the ET command(s) should be + issued early. (The Element Reference describes the available + elements.) + + A special option, ``ename=0``, permits the specified element + type to be ignored during solution without actually removing + the element from the model. Ename may be set to zero only + after the element type has been previously defined with a + nonzero Ename. The preferred method of ignoring elements is + to use the select commands (such as ESEL). + + KOPn are element option keys. These keys (referred to as + KEYOPT(n)) are used to turn on certain element options for + this element. These options are listed under "KEYOPT" in the + input table for each element type in the Element Reference. + KEYOPT values include stiffness formulation options, printout + controls, and various other element options. If KEYOPT(7) or + greater is needed, input their values with the KEYOPT command. + + The ET command only defines an element type local to your + model (from the types in the element library). The TYPE or + similar [KATT, LATT, AATT, or VATT] command must be used to + point to the desired local element type before meshing. + + To activate the ANSYS program's LS-DYNA explicit dynamic + analysis capability, use the ET command + to choose an element that works only with LS-DYNA (such as + SHELL163). + + Examples + -------- + Define an element type. Allow MAPDL to pick your the element + type. + + >>> etype_num = mapdl.et('', 'SURF154') + >>> etype_num + 1 + + Define an element type while specifying the element type + number. + + >>> etype_num = mapdl.et(2, 'SOLID186') + >>> etype_num + 2 + """ + command = ( + f"ET,{itype},{ename},{kop1},{kop2},{kop3},{kop4},{kop5},{kop6},{inopr}" + ) + return parse.parse_et(self.run(command, **kwargs)) + + def etchg(self, cnv: str = "", **kwargs): + r"""Changes element types to their corresponding types. + + Mechanical APDL Command: `ETCHG `_ + + Parameters + ---------- + cnv : str + Converts the element types to the corresponding type. Valid labels are: + + * ``TTS`` - Thermal to Structural + + * ``STT`` - Structural to Thermal + + * ``MTT`` - Magnetic to Thermal + + * ``FTS`` - Fluid to Structural + + * ``ETS`` - Electrostatic to Structural + + * ``ETT`` - Electrical to Thermal + + Notes + ----- + + .. _ETCHG_notes: + + Changes the currently defined element types to their corresponding types. Elements without a + companion element (listed above) are not switched and should be switched with the :ref:`et` command + to an appropriate element type or to a null element. The KEYOPT values for the switched element + types are reset to zero or to their default values. You must check these values to see if they are + still meaningful. Additionally, if ``Cnv`` = ETI, ITE, or TTE, all real constants are set to zero. + + If ``Cnv`` = ITE, you will need to choose a material model that corresponds to your previously- + defined material properties. If working interactively, the application prompts you to do so. + + .. _ETCHG_extranote1: + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + """ + command = f"ETCHG,{cnv}" + return self.run(command, **kwargs) + + def etcontrol(self, eltech: str = "", eldegene: str = "", **kwargs): + r"""Control the element technologies used in element formulation (for applicable elements). + + Mechanical APDL Command: `ETCONTROL `_ + + Parameters + ---------- + eltech : str + Element technology control: + + * ``SUGGESTION`` - The program offers a suggestion for the best element technology before solving. + If necessary, mixed u-P (KEYOPT(6)) is also included and reset. This behavior is the default. + + * ``SET`` - The program informs you of the best settings and resets any applicable KEYOPT settings + automatically. This action overrides any previous manual settings. + + * ``OFF`` - Deactivates automatic selection of element technology. No suggestions are issued, and no + automatic resetting occurs. + + eldegene : str + Element degenerated shape control: + + * ``ON`` - If element shapes are degenerated, the degenerated shape function is employed and + enhanced strain, simplified enhanced strain, and B-bar formulations are turned off (default). + + * ``OFF`` - If element shapes are degenerated, regular shape functions are still used, and the + specified element technologies (for example, enhanced strain, B-bar, uniform reduced integration) + are still used. + + Notes + ----- + + .. _ETCONTROL_notes: + + This command is valid for elements ``SHELL181``, ``PLANE182``, ``PLANE183``, ``SOLID185``, + ``SOLID186``, ``SOLID187``, ``BEAM188``, ``BEAM189``, ``SHELL208``, ``SHELL209``, ``PLANE222``, + ``PLANE223``, ``SOLID225``, ``SOLID226``, ``SOLID227``, ``REINF264``, ``SOLID272``, ``SOLID273``, + ``SHELL281``, ``SOLID285``, ``PIPE288``, ``PIPE289``, ``ELBOW290``. + + For more information, see `Automatic Selection of Element Technologies and Formulations + `_ + """ + command = f"ETCONTROL,{eltech},{eldegene}" + return self.run(command, **kwargs) + + def etdele(self, ityp1: str = "", ityp2: str = "", inc: str = "", **kwargs): + r"""Deletes element types. + + Mechanical APDL Command: `ETDELE `_ + + Parameters + ---------- + ityp1 : str + Deletes element types from ``ITYP1`` to ``ITYP2`` (defaults to ``ITYP1`` ) in steps of ``INC`` + (defaults to 1). If ``ITYP1`` = ALL, ``ITYP2`` and ``INC`` are ignored and all element types are + deleted. Element types are defined with the :ref:`et` command. + + ityp2 : str + Deletes element types from ``ITYP1`` to ``ITYP2`` (defaults to ``ITYP1`` ) in steps of ``INC`` + (defaults to 1). If ``ITYP1`` = ALL, ``ITYP2`` and ``INC`` are ignored and all element types are + deleted. Element types are defined with the :ref:`et` command. + + inc : str + Deletes element types from ``ITYP1`` to ``ITYP2`` (defaults to ``ITYP1`` ) in steps of ``INC`` + (defaults to 1). If ``ITYP1`` = ALL, ``ITYP2`` and ``INC`` are ignored and all element types are + deleted. Element types are defined with the :ref:`et` command. + """ + command = f"ETDELE,{ityp1},{ityp2},{inc}" + return self.run(command, **kwargs) + + def etlist(self, ityp1: str = "", ityp2: str = "", inc: str = "", **kwargs): + r"""Lists currently defined element types. + + Mechanical APDL Command: `ETLIST `_ + + Parameters + ---------- + ityp1 : str + Lists element types from ``ITYP1`` to ``ITYP2`` (defaults to ``ITYP1`` ) in steps of ``INC`` + (defaults to 1). If ``ITYP1`` = ALL (default), ``ITYP2`` and ``INC`` are ignored and all element + types are listed. + + ityp2 : str + Lists element types from ``ITYP1`` to ``ITYP2`` (defaults to ``ITYP1`` ) in steps of ``INC`` + (defaults to 1). If ``ITYP1`` = ALL (default), ``ITYP2`` and ``INC`` are ignored and all element + types are listed. + + inc : str + Lists element types from ``ITYP1`` to ``ITYP2`` (defaults to ``ITYP1`` ) in steps of ``INC`` + (defaults to 1). If ``ITYP1`` = ALL (default), ``ITYP2`` and ``INC`` are ignored and all element + types are listed. + + Notes + ----- + + .. _ETLIST_notes: + + This command is valid in any processor. + """ + command = f"ETLIST,{ityp1},{ityp2},{inc}" + return self.run(command, **kwargs) + + def keyopt(self, itype: str = "", knum: str = "", value: str = "", **kwargs): + r"""Sets element key options. + + Mechanical APDL Command: `KEYOPT `_ + + Parameters + ---------- + itype : str + Element type number as defined on the :ref:`et` command. + + The following labels are valid input for contact elements: + + * ``CONT`` - Set element key options for all contact element types, ``CONTA172``, ``CONTA174``, + ``CONTA175``, and ``CONTA177``. + + * ``TARG`` - Set element key options for all target element types, ``TARGE169`` and ``TARGE170``. + + * ``GCN`` - Set element key options for all contact element types used in a `general contact + `_ + definition (that is, all contact elements having a real constant set number = 0). + + See `Notes + `_ + Notes for additional ``ITYPE`` input specific to general contact. + + knum : str + Number of the KEYOPT to be defined (KEYOPT( ``KNUM`` )). + + value : str + Value of this KEYOPT. + + Notes + ----- + + .. _KEYOPT_notes: + + The :ref:`keyopt` command is an alternative method for inputting element key option (KEYOPT) values + via the :ref:`et` command. (Issue the :ref:`et` command first to define ``ITYPE`` ). + + The :ref:`keyopt` command is required for inputting key options numbered higher than six (that is, > + KEYOPT(6)). + + .. _refsect2_kpb_rp5_xv: + + If :ref:`etcontrol`,SET is enabled, key options that you specify via the :ref:`keyopt` command might + be overridden for many structural elements. For more information, see `Automatic Selection of + Element Technologies and Formulations + `_ + + .. _refsect2_ibn_np5_xv: + + Specify ``ITYPE`` = GCN to set element key options for all contact element types used in a `general + contact `_ + definition. You can selectively set element key options for multiple contact element types in a + general contact definition by setting ``ITYPE`` to a valid label (ALL_EDGE, ALL_FACE, ALL_VERT, + ALL_TOP, or ALL_BOT) or by inputting a node component name with or without a component name + extension (_EDGE, _FACE, _VERT, _TOP, or _BOT). For more information, see `Defining Non-Default + Contact Settings + `_ + """ + command = f"KEYOPT,{itype},{knum},{value}" + return self.run(command, **kwargs) + + def nsvr(self, itype: str = "", nstv: str = "", **kwargs): + r"""Defines the number of variables for user-programmable element options. + + Mechanical APDL Command: `NSVR `_ + + Parameters + ---------- + itype : str + Element type number as defined on the :ref:`et` command. + + nstv : str + Number of extra state variables to save (must be no more than 840). + + Notes + ----- + + .. _NSVR_notes: + + Defines the number of extra variables that need to be saved for user-programmable (system-dependent) + element options, for example, material laws through user subroutine USERPL. ``ITYPE`` must first be + defined with the :ref:`et` command. + """ + command = f"NSVR,{itype},{nstv}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/prep7/elements.py b/src/ansys/mapdl/core/_commands/prep7/elements.py new file mode 100644 index 00000000000..25c7981b53c --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/elements.py @@ -0,0 +1,3835 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from ansys.mapdl.core._commands import parse + + +class Elements: + + def afsurf(self, sarea: str = "", tline: str = "", **kwargs): + r"""Generates surface elements overlaid on the surface of existing solid elements and assigns the extra + node as the closest fluid element node. + + Mechanical APDL Command: `AFSURF `_ + + Parameters + ---------- + sarea : str + Component name for the surface areas of the meshed solid volumes. The component name must be 32 + characters or less. + + tline : str + Component name for the target lines meshed with fluid elements. The component name must be 32 + characters or less. + + Notes + ----- + + .. _AFSURF_notes: + + This command macro is used to generate surface effect elements overlaid on the surface of existing + solid elements and, based on proximity, to determine and assign the extra node for each surface + element. The underlying volumes of the solid region and the fluid lines must be meshed prior to + calling this command macro. The active element type must be ``SURF152`` with appropriate settings + for KEYOPT(4), KEYOPT(5), KEYOPT(6), and KEYOPT(8). + + The surface areas of the solid and the target lines of the fluid are grouped into components and + named using the :ref:`cm` command. The names must be enclosed in single quotes (for example, ' + ``SAREA`` ') when the :ref:`afsurf` command is manually typed in. + + When using the GUI method, node and element components are created through the picking dialog boxes + associated with this command. + + The macro is applicable for the ``SURF152`` and ``FLUID116`` element types. + """ + command = f"AFSURF,{sarea},{tline}" + return self.run(command, **kwargs) + + def dflab(self, dof: str = "", displab: str = "", forcelab: str = "", **kwargs): + r"""Changes degree-of-freedom labels for user custom elements. + + Mechanical APDL Command: `/DFLAB `_ + + Parameters + ---------- + dof : str + Number between 1 and 32 indicating which degree of freedom is to have its labels changed. For a list + of these quantities, see the degree-of-freedom table in the :file:`echprm.inc` file. The first few quantities follow: + + * 1 = UX,FX + * 2 = UY,FY + * 3 = UZ,FZ + * 4 = ROTX,MX + + displab : str + New label (four-character maximum) for the displacement label. The prior label is no longer + valid. + + forcelab : str + New label (four-character maximum) for the force label for this degree of freedom. The prior + label is no longer valid. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + **Argument Descriptions** + + .. _s-DFLAB_argdescript: + + * ``dof : str`` - Number between 1 and 32 indicating which degree of freedom is to have its labels + changed. For a list + of these quantities, see the degree-of-freedom table in the :file:`echprm.inc` file. The first few quantities follow: + + * 1 = UX,FX + * 2 = UY,FY + * 3 = UZ,FZ + * 4 = ROTX,MX + + * ``displab : str`` - New label (four-character maximum) for the displacement label. The prior label + is no longer valid. + + * ``forcelab : str`` - New label (four-character maximum) for the force label for this degree of + freedom. The prior label is no longer valid. + + .. _s-DFLAB_notes: + + The :ref:`dflab` command is rarely used. Use it if you are writing a custom element and want to use + degrees of freedom that are not part of the standard element set. + """ + command = f"/DFLAB,{dof},{displab},{forcelab}" + return self.run(command, **kwargs) + + def e( + self, + i: str = "", + j: str = "", + k: str = "", + l: str = "", + m: str = "", + n: str = "", + o: str = "", + p: str = "", + **kwargs, + ): + r"""Defines an element by node connectivity. + + Mechanical APDL Command: `E `_ + + Parameters + ---------- + i : str + Number of node assigned to first nodal position (node I). If ``I`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). + + j : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + k : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + l : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + m : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + n : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + o : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + p : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + Notes + ----- + + .. _E_notes: + + Defines an element by its nodes and attribute values. You can specify up to eight nodes. You can add + more nodes if needed ( :ref:`emore` ). + + The number of nodes required and the order in which they are specified are described in `Element + Input + `_ + :ref:`numstr` ) as generated. The current (or default) MAT, TYPE, REAL, SECNUM and ESYS attribute + values are also assigned to the element. + + When creating elements with more than eight nodes ( :ref:`e` followed by :ref:`emore` ), it may be + necessary disable shape-checking ( :ref:`shpp` ) before issuing this command. + + If a valid element type can be created without using additional nodes ( :ref:`emore` ), this command + creates that element. :ref:`emore` then modifies the element to include the additional nodes. If + shape-checking is active, it occurs before :ref:`emore` is issued. If the shape-checking limits are + exceeded, therefore, element creation may fail before :ref:`emore` modifies the element into an + acceptable shape. + + Examples + -------- + Create a single SURF154 element. + + >>> mapdl.prep7() + >>> mapdl.et(1, 'SURF154') + >>> mapdl.n(1, 0, 0, 0) + >>> mapdl.n(2, 1, 0, 0) + >>> mapdl.n(3, 1, 1, 0) + >>> mapdl.n(4, 0, 1, 0) + >>> mapdl.e(1, 2, 3, 4) + 1 + + Create a single hexahedral SOLID185 element + + >>> mapdl.et(2, 'SOLID185') + >>> mapdl.type(2) + >>> mapdl.n(5, 0, 0, 0) + >>> mapdl.n(6, 1, 0, 0) + >>> mapdl.n(7, 1, 1, 0) + >>> mapdl.n(8, 0, 1, 0) + >>> mapdl.n(9, 0, 0, 1) + >>> mapdl.n(10, 1, 0, 1) + >>> mapdl.n(11, 1, 1, 1) + >>> mapdl.n(12, 0, 1, 1) + >>> mapdl.e(5, 6, 7, 8, 9, 10, 11, 12) + 2 + """ + command = f"E,{i},{j},{k},{l},{m},{n},{o},{p}" + return parse.parse_e(self.run(command, **kwargs)) + + def ecpchg(self, **kwargs): + r"""Optimizes degree-of-freedom usage in a coupled acoustic model. + + Mechanical APDL Command: `ECPCHG `_ + + Notes + ----- + + .. _ECPCHG_notes: + + The :ref:`ecpchg` command converts uncoupled acoustic element types to coupled acoustic element + types that are attached to the fluid-structure interaction interface. Or it converts coupled + acoustic element types to uncoupled acoustic element types that are not attached to the fluid- + structure interaction interface. Issuing :ref:`ecpchg` can dramatically reduce the size of the + :file:`Jobname.EMAT` file, compared to the model fully meshed with the coupled acoustic elements. + + Performing the :ref:`ecpchg` conversion on meshed volumes can create circumstances in which more + than one element type is defined for a single volume. + + If the acoustic elements are coupled with shell elements ( ``SHELL181`` or ``SHELL281`` ), you must + set the fluid-structure interaction (FSI) flag by issuing the :ref:`sf`,,FSI command before the + :ref:`ecpchg` command. + + :ref:`ecpchg` may add new element types to your model, or it may change the element type for + existing acoustic elements. You should verify the defined element types with :ref:`etlist` and the + element attributes with :ref:`elist` after using this command. + """ + command = "ECPCHG" + return self.run(command, **kwargs) + + def edele(self, iel1: str = "", iel2: str = "", inc: str = "", **kwargs): + r"""Deletes selected elements from the model. + + Mechanical APDL Command: `EDELE `_ + + Parameters + ---------- + iel1 : str + Delete elements from ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in steps of ``INC`` (defaults + to 1). If ``IEL1`` = ALL, ``IEL2`` and ``INC`` are ignored and all selected elements ( + :ref:`esel` ) are deleted. If ``IEL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``IEL1`` ( ``IEL2`` and ``INC`` are ignored). + + iel2 : str + Delete elements from ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in steps of ``INC`` (defaults + to 1). If ``IEL1`` = ALL, ``IEL2`` and ``INC`` are ignored and all selected elements ( + :ref:`esel` ) are deleted. If ``IEL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``IEL1`` ( ``IEL2`` and ``INC`` are ignored). + + inc : str + Delete elements from ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in steps of ``INC`` (defaults + to 1). If ``IEL1`` = ALL, ``IEL2`` and ``INC`` are ignored and all selected elements ( + :ref:`esel` ) are deleted. If ``IEL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``IEL1`` ( ``IEL2`` and ``INC`` are ignored). + + Notes + ----- + + .. _EDELE_notes: + + Deleted elements are replaced by null or "blank" elements. Null elements are used only for retaining + the element numbers so that the element numbering sequence for the rest of the model is not changed + by deleting elements. Null elements may be removed (although this is not necessary) with the + :ref:`numcmp` command. If related element data (pressures, etc.) are also to be deleted, delete that + data before deleting the elements. :ref:`edele` is for unattached elements only. You can use the + **xCLEAR** family of commands to remove any attached elements from the database. + """ + command = f"EDELE,{iel1},{iel2},{inc}" + return self.run(command, **kwargs) + + def eembed(self, **kwargs): + r"""Generates bonded connections between intersecting elements. + + Mechanical APDL Command: `EEMBED `_ + + Notes + ----- + + .. _EEMBED_notes: + + From selected elements, :ref:`eembed` identifies embedded elements that are partially or completely + enclosed within other (base) elements, determines the interior intersection surfaces between the + embedded and base elements, and generates special-purpose ``REINF265`` reinforcing elements + representing the bonded connection stiffness of the interior intersection surfaces. + + Supported base elements are 3D structural solids ( ``SOLID185``, ``SOLID186``, ``SOLID187``, and + ``SOLID285`` ) and thermal solids ( ``SOLID278``, ``SOLID279``, and ``SOLID291`` ). Supported + embedded elements are 3D structural links and beams ( ``LINK180``, ``BEAM188``, and ``BEAM189`` ) + and thermal link ( ``LINK33`` ). + + Before issuing :ref:`eembed`, define the base and embedded elements, then select the elements to be + included for embedded connections. Mesh conformity between the base and embedded elements is not + required. A combination of supported base and embedded element types is allowed. + + The command has no arguments. Simply issue the command to perform the embedding procedure. + + You can inspect newly created reinforcing element types, sections, and elements ( :ref:`etlist`, + :ref:`slist`, :ref:`elist`, or :ref:`eplot` ). + + Do not issue other preprocessing commands (such as :ref:`et`, :ref:`e`, :ref:`emodif`, and + :ref:`sectype` ) to create or modify the special-purpose reinforcing elements, element types, and + sections. + + Elements generated by :ref:`eembed` are not associated with the solid model. + + Reinforcing elements do not account for subsequent modifications made to the base and embedded + elements. To avoid inconsistencies, issue :ref:`eembed` only after the base elements are finalized. + If you delete or modify base or embedded elements (for example, via :ref:`edele`, :ref:`emodif`, + :ref:`etchg`, :ref:`emid`, :ref:`eorient`, :ref:`nummrg`, or :ref:`numcmp` ), remove all affected + reinforcing elements and associated sections, and reissue :ref:`eembed`. + + :ref:`eembed` creates new reinforcing sections (of ``Subtype`` = `GCON + `_ + ) containing details about the created ``REINF265`` elements, then applies them to all newly + generated special-purpose ``REINF265`` elements. The number of new reinforcing sections depends on + the number of new ``REINF265`` elements. (You can examine the properties of new sections ( + :ref:`slist` ).) The program sets the ID number of the newest reinforcing section to the highest + available section ID number in the model. After issuing :ref:`eembed`, the command shows the + highest-numbered IDs (element type, element, and section). Do not overwrite a new reinforcing + section when defining subsequent sections. + + If performing a subsequent structural analysis after the thermal analysis, you can use :ref:`eembed` + to convert the reinforcing elements for the structural analysis, as follows: + + Convert the thermal base and embedded elements to the appropriate structural element ( :ref:`et` or + :ref:`emodif` ). + + Select the reinforcing elements generated by :ref:`eembed` in the previous thermal analysis only. + + Issue :ref:`eembed`. + + Result : The program modifies the attributes of the selected reinforcing elements so that they are + compatible with the converted base and embedded elements. + + For more information about using this command, see `Direct-Embedding Workflow + `_ + """ + command = "EEMBED" + return self.run(command, **kwargs) + + def egen( + self, + itime: str = "", + ninc: str = "", + iel1: str = "", + iel2: str = "", + ieinc: str = "", + minc: str = "", + tinc: str = "", + rinc: str = "", + cinc: str = "", + sinc: str = "", + dx: str = "", + dy: str = "", + dz: str = "", + **kwargs, + ): + r"""Generates elements from an existing pattern. + + Mechanical APDL Command: `EGEN `_ + + Parameters + ---------- + itime : str + Do this generation operation a total of ``ITIME`` s, incrementing all nodes in the given pattern + by ``NINC`` each time after the first. ``ITIME`` must be >1 if generation is to occur. ``NINC`` + may be positive, zero, or negative. If ``DX``, ``DY``, and/or ``DZ`` is specified, ``NINC`` + should be set so any existing nodes (as on :ref:`ngen` ) are not overwritten. + + ninc : str + Do this generation operation a total of ``ITIME`` s, incrementing all nodes in the given pattern + by ``NINC`` each time after the first. ``ITIME`` must be >1 if generation is to occur. ``NINC`` + may be positive, zero, or negative. If ``DX``, ``DY``, and/or ``DZ`` is specified, ``NINC`` + should be set so any existing nodes (as on :ref:`ngen` ) are not overwritten. + + iel1 : str + Generate elements from selected pattern beginning with ``IEL1`` to ``IEL2`` (defaults to + ``IEL1`` ) in steps of ``IEINC`` (defaults to 1). If ``IEL1`` is negative, ``IEL2`` and + ``IEINC`` are ignored and the last \| ``IEL1`` \| elements (in sequence backward from the maximum + element number) are used as the pattern to be repeated. If ``IEL1`` = ALL, ``IEL2`` and + ``IEINC`` are ignored and use all selected elements ( :ref:`esel` ) as pattern to be repeated. + If ``P1`` = P, graphical picking is enabled and all remaining command fields are ignored (valid + only in the GUI). A component name may also be substituted for ``IEL1`` ( ``IEL2`` and ``INC`` + are ignored). + + iel2 : str + Generate elements from selected pattern beginning with ``IEL1`` to ``IEL2`` (defaults to + ``IEL1`` ) in steps of ``IEINC`` (defaults to 1). If ``IEL1`` is negative, ``IEL2`` and + ``IEINC`` are ignored and the last \| ``IEL1`` \| elements (in sequence backward from the maximum + element number) are used as the pattern to be repeated. If ``IEL1`` = ALL, ``IEL2`` and + ``IEINC`` are ignored and use all selected elements ( :ref:`esel` ) as pattern to be repeated. + If ``P1`` = P, graphical picking is enabled and all remaining command fields are ignored (valid + only in the GUI). A component name may also be substituted for ``IEL1`` ( ``IEL2`` and ``INC`` + are ignored). + + ieinc : str + Generate elements from selected pattern beginning with ``IEL1`` to ``IEL2`` (defaults to + ``IEL1`` ) in steps of ``IEINC`` (defaults to 1). If ``IEL1`` is negative, ``IEL2`` and + ``IEINC`` are ignored and the last \| ``IEL1`` \| elements (in sequence backward from the maximum + element number) are used as the pattern to be repeated. If ``IEL1`` = ALL, ``IEL2`` and + ``IEINC`` are ignored and use all selected elements ( :ref:`esel` ) as pattern to be repeated. + If ``P1`` = P, graphical picking is enabled and all remaining command fields are ignored (valid + only in the GUI). A component name may also be substituted for ``IEL1`` ( ``IEL2`` and ``INC`` + are ignored). + + minc : str + Increment material number of all elements in the given pattern by ``MINC`` each time after the + first. + + tinc : str + Increment element type number by ``TINC``. The element types with incremented numbers must be + defined before issuing the :ref:`egen` command. + + rinc : str + Increment real constant table number by ``RINC``. + + cinc : str + Increment element coordinate system number by ``CINC``. + + sinc : str + Increment section ID number by ``SINC``. + + dx : str + Define nodes that do not already exist but are needed by generated elements (as though the + :ref:`ngen`, ``ITIME,INC,NODE1,,,DX,DY,DZ`` were issued before :ref:`egen` ). Zero is a valid + value. If blank, ``DX``, ``DY``, and ``DZ`` are ignored. + + dy : str + Define nodes that do not already exist but are needed by generated elements (as though the + :ref:`ngen`, ``ITIME,INC,NODE1,,,DX,DY,DZ`` were issued before :ref:`egen` ). Zero is a valid + value. If blank, ``DX``, ``DY``, and ``DZ`` are ignored. + + dz : str + Define nodes that do not already exist but are needed by generated elements (as though the + :ref:`ngen`, ``ITIME,INC,NODE1,,,DX,DY,DZ`` were issued before :ref:`egen` ). Zero is a valid + value. If blank, ``DX``, ``DY``, and ``DZ`` are ignored. + + Notes + ----- + + .. _EGEN_notes: + + A pattern may consist of any number of previously defined elements. The MAT, TYPE, REAL, ESYS, and + SECNUM numbers of the new elements are based upon the elements in the pattern and not upon the + current specification settings. + + You can use the :ref:`egen` command to generate interface elements ( ``INTER192``, ``INTER193``, + ``INTER194``, and ``INTER195`` ) directly. However, because interface elements require that the + element connectivity be started from the bottom surface, you must make sure that you use the correct + element node connectivity. See the element descriptions for ``INTER192``, ``INTER193``, + ``INTER194``, and ``INTER195`` for the correct element node definition. + """ + command = f"EGEN,{itime},{ninc},{iel1},{iel2},{ieinc},{minc},{tinc},{rinc},{cinc},{sinc},{dx},{dy},{dz}" + return self.run(command, **kwargs) + + def egid(self, val: str = "", **kwargs): + r"""Specifies a global identifier for a set of ``MESH200`` elements. + + Mechanical APDL Command: `EGID `_ + + Parameters + ---------- + val : str + An integer for identifying a set of ``MESH200`` elements used in a `reinforcing + `_ + analysis. Default = 1. + + Notes + ----- + ``VAL`` is a global identifier that you assign to a set of ``MESH200`` elements in a `reinforcing + `_ + analysis. The command is valid only when using the `mesh-independent method + `_ for + defining reinforcing. + + The global identifier that you specify is transferred to the reinforcing members (individual + reinforcings) when they are generated ( :ref:`ereinf` ). + + Issue :ref:`egid` before generating the ``MESH200`` elements. + + If necessary, you can change the global identifier for an existing set of ``MESH200`` elements ( + :ref:`emodif` ). + + For more information about using this command in a mesh-independent reinforcing analysis, see + `Selecting and Displaying Groups of Reinforcing Members + `_ + """ + command = f"EGID,{val}" + return self.run(command, **kwargs) + + def einfin( + self, + compname: str = "", + pnode_nref1: str = "", + nref2: str = "", + nref3: str = "", + matid: str = "", + **kwargs, + ): + r"""Generates structural infinite elements from selected nodes. + + Mechanical APDL Command: `EINFIN `_ + + Parameters + ---------- + compname : str + Component name containing the reference nodes for calculating the position of poles for generating + ``INFIN257`` structural infinite elements. + + The number of poles and their positions are based on the number of included nodes: + + * If the component includes only one node, the node becomes the pole node. The pole node is + typically located at or near the geometric center of the finite element domain if there is a + single pole. + + * If the component includes two (2D) or three nodes (3D), the program constructs an infinite line or + area, then calculates the pole positions by drawing a perpendicular line from a selected node to + the line or area. + + * If the component includes more than two (2D) or three nodes (3D), the program uses the first two + or three nodes calculate the position of poles. + + pnode_nref1 : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for + further information. + + nref2 : str + Node number of the second reference node used to calculate pole positions. (A parameter or + parametric expression is also valid.) Specify this value when no ``CompName`` has been + specified. (If ``CompName`` is specified, this value is ignored.) To input this value, first + specify ``NREF1`` (replacing ``PNODE`` ). Pole positions are calculated on an infinite line + defined by ``NREF1`` and ``NREF2``. + + nref3 : str + Node number of the third reference node used to calculate pole positions. (A parameter or + parametric expression is also valid.) Specify this value when no ``CompName`` has been + specified. (If ``CompName`` is specified, this value is ignored.) To input this value, first + specify ``NREF1`` (replacing ``PNODE`` ) and ``NREF2``. Pole positions are calculated on an + infinite line defined by ``NREF1``, ``NREF2``, and ``NREF3``. + + matid : str + Optional material ID of the structural infinite element. (A parameter or parametric expression + is also valid.) If specified, this value defines the material properties of the structural + infinite elements explicitly; otherwise, the material ID is copied from the base elements. + + Notes + ----- + + .. _EINFIN_notes: + + The :ref:`einfin` command generates structural infinite elements ( ``INFIN257`` ) directly from the + selected face of `valid base elements + `_ + (existing standard elements in your model). The command scans all base elements for the selected + nodes and generates a compatible infinite element type for each base element. A combination of + different base element types is allowed if the types are all compatible with the infinite elements. + + The infinite element type requires no predefinition ( :ref:`et` ). + + The faces of base elements are determined from the selected node set ( :ref:`nsel` ), and the + geometry of the infinite element is determined based on the shape of the face. Element + characteristics and options are determined according to the base element. For the face to be used, + all nodes on the face of a base element must be selected + + Use base elements to model the near-field domain that interacts with the solid structures or applied + loads. To apply the truncated far-field effect, a single layer of infinite elements must be attached + to the near-field domain. The outer surface of the near-field domain must be convex. + + The material of the structural infinite elements can be defined in either of two ways. If ``MATID`` + is specified, the command uses that value to define the material property of the structural infinite + elements. If ``MATID`` is not specified, the material ID of the base element is copied to the + attached infinite element. Although only isotropic material is allowed for the infinite elements, + these options enable you to define anisotropic material for the base elements in a static analysis. + (In a transient analysis, however, use the same isotropic material for both base elements and + infinite elements.) + + After the :ref:`einfin` command executes, you can verify the newly created infinite element types + and elements ( :ref:`etlist`, :ref:`elist`, :ref:`eplot` ). + + Infinite elements do not account for any subsequent modifications made to the base elements. It is + good practice to issue the :ref:`einfin` command only after the base elements are finalized. If you + delete or modify base elements (via :ref:`edele`, :ref:`emodif`, :ref:`etchg`, :ref:`emid`, + :ref:`eorient`, :ref:`nummrg`, or :ref:`numcmp` commands, for example) after generating the + structural infinite elements, remove all affected infinite elements and reissue the :ref:`einfin` + command; doing so prevents inconsistencies. + + **Command Usage Examples** + **Example: Single Reference Node (Pole)** + + **2D Elements:** + + .. code:: apdl + + /prep7 + et,1,182 + mp,ex,1,1e9 + mp,nuxy,1,0.3 + + type,1 ! Generate solid elements + mat,1 + rect,0,4,0,4 + elsize,1 + allsel + mshkey,1 + amesh,1 + + n1 = node(0,4,0) ! Select reference node + nsel,s,loc,x,4 ! Select nodes on base element + nsel,a,loc,y,0 + EINFIN,,n1 + + **3D Elements:** + + .. code:: apdl + + /prep7 + et,1,185 ! Generate solid elements + mp,ex,1,1e9 + mp,nuxy,1,0.3 + + type,1 + mat,1 + block,0,4,0,4,0,4 + elsize,1 + + mshkey,1 + vmesh,1 + + n1 = node(0,0,4) ! Select reference node + nsel,,loc,x,4 ! Select nodes on base elements + nsel,a,loc,y,4 + nsel,a,loc,z,0 + EINFIN,,n1 + + **Example: Two Reference Nodes** + + **2D Elements:** + + .. code:: apdl + + /prep7 + et,1,182 ! Generate solid elements + mp,ex,1,1e9 + mp,nuxy,1,0.3 + type,1 + mat,1 + rect,0,4,0,4 + elsize,1 + allsel + mshkey,1 + amesh,1 + + n1 = node(0,0,0) ! Select reference nodes + n2 = node(0,4,0) + + nsel,,loc,x,4 ! Select nodes on base elements + EINFIN,,n1,n2 + + Following is the equivalent input with a component: + + .. code:: apdl + + /prep7 + et,1,182 ! Generate solid elements mp,ex,1,1e9 + mp,nuxy,1,0.3 + type,1 + mat,1 + rect,0,4,0,4 + elsize,1 + allsel + mshkey,1 + amesh,1 + + n1 = node(0,0,0) ! Select reference nodes + n2 = node(0,4,0) + nsel,,node,,n1 + nsel,a,node,,n2 + cm, nrefs, node ! Define component + allsel + nsel,,loc,x,4 ! Select nodes on base elements + EINFIN, nrefs + + **3D Elements:** + + .. code:: apdl + + /prep7 + + et,1,185 ! Generate solid elements + mp,ex,1,1e9 + mp,nuxy,1,0.3 + + type,1 + mat,1 + block,0,4,0,4,0,4 + elsize,1 + mshkey,1 + vmesh,1 + + n1 = node(0,0,4) ! Select reference nodes + n2 = node(0,4,4) + nsel,,loc,x,4 ! Select nodes on base elements + EINFIN,,n1, n2 + + **Example: Three Reference Nodes** + + **3D Elements Only:** + + .. code:: apdl + + /prep7 + + et,1,185 ! Generate solid elements + mp,ex,1,1e9 + mp,nuxy,1,0.3 + + type,1 + mat,1 + block,0,4,0,4,0,4 + elsize,1 + mshkey,1 + vmesh,1 + + n1 = node(0,4,4) ! Select reference nodes + n2 = node(0,0,4) + n3 = node(0,0,0) + nsel,,loc,x,4 ! Select nodes on base elements + EINFIN,,n1,n2,n3 + + **Example: Multiple EINFIN Commands** + + **2D Elements:** + + .. code:: apdl + + /prep7 + et,1,182 + mp,ex,1,1e9 + mp,nuxy,1,0.3 + + type,1 ! Generate solid elements + mat,1 + rect,0,4,0,4 + elsize,1 + allsel + mshkey,1 + amesh,1 + + n1 = node(0,0,0) + n2 = node(0,4,0) + nsel,,loc,x,4, + nsel,r,loc,y,0.5,5 + EINFIN,,n1,n2 ! upper right quad. elements + nsel,all + nsel,,loc,x,4 + nsel,r,loc,y,0,1.5 + EINFIN,,n2 ! Lower corner element + nsel,all + n3 = node(4,4,0) + nsel,s,loc,y,0 + EINFIN,,n2,n3 ! Lower elements (y<0) + + **3D Elements:** + + .. code:: apdl + + /prep7 + + et,1,185 ! Generate solid elements + mp,ex,1,1e9 + mp,nuxy,1,0.3 + + type,1 + mat,1 + + block,0,4,0,4,0,4 + elsize,1 + + mshkey,1 + vmesh,1 + + n1 = node(0,0,0) + n2 = node(0,0,4) + n3 = node(0,4,4) + + nsel,s,loc,x,4, + nsel,u,loc,z,0 + EINFIN, n1, n2, n3 ! Upper right part + allsel + nsel,s,loc,x,4 + nsel,r,loc,z,-0.1,1.2 + EINFIN,,n2,n3 ! Corner element + allsel + n5 = node(4,4,4) + nsel,s,loc,z,0 + EINFIN,,n2,n3,n5 ! Lower part (z<0) + """ + command = f"EINFIN,{compname},{pnode_nref1},{nref2},{nref3},{matid}" + return self.run(command, **kwargs) + + def eintf( + self, + toler: str = "", + k: str = "", + tlab: str = "", + kcn: str = "", + dx: str = "", + dy: str = "", + dz: str = "", + knonrot: str = "", + **kwargs, + ): + r"""Defines two-node elements between coincident or offset nodes. + + Mechanical APDL Command: `EINTF `_ + + Parameters + ---------- + toler : str + Tolerance for coincidence (based on maximum Cartesian coordinate difference for node locations + and on angle differences for node orientations). Defaults to 0.0001. Only nodes within the + tolerance are considered to be coincident. + + k : str + Only used when the type of the elements to be generated is ``PRETS179``. ``K`` is the pretension + node that is common to the pretension section that is being created. If ``K`` is not specified, + it is created automatically and will have an Mechanical APDL-assigned node number. If ``K`` is + specified but does not already exist, it will be created automatically but will have the user- + specified node number. ``K`` cannot be connected to any existing element. + + tlab : str + Nodal number ordering. Allowable values are: + + * ``LOW`` - The 2-node elements are generated from the lowest numbered node to the highest numbered + node. + + * ``HIGH`` - The 2-node elements are generated from the highest numbered node to the lowest numbered + node. + + * ``REVE`` - Reverses the orientation of the selected 2-node element. + + kcn : str + In coordinate system ``KCN``, elements are created between node 1 and node 2 (= node 1 + dx dy + dz). + + dx : str + Node location increments that define the node offset in the active coordinate system (DR, Dθ, DZ + for cylindrical and DR, Dθ, DΦ for spherical or toroidal). + + dy : str + Node location increments that define the node offset in the active coordinate system (DR, Dθ, DZ + for cylindrical and DR, Dθ, DΦ for spherical or toroidal). + + dz : str + Node location increments that define the node offset in the active coordinate system (DR, Dθ, DZ + for cylindrical and DR, Dθ, DΦ for spherical or toroidal). + + knonrot : str + When ``KNONROT`` = 0, the nodes coordinate system is not rotated. When ``KNONROT`` = 1, the + nodes belonging to the elements created are rotated into coordinate system ``KCN`` (see + :ref:`nrotat` command description). + + Notes + ----- + + .. _EINTF_notes: + + Defines 2-node elements (such as gap elements) between coincident or offset nodes (within a + tolerance). May be used, for example, to "hook" together elements interfacing at a seam, where the + seam consists of a series of node pairs. One element is generated for each set of two coincident + nodes. For more than two coincident or offset nodes in a cluster, an element is generated from the + lowest numbered node to each of the other nodes in the cluster. If fewer than all nodes are to be + checked for coincidence, use the :ref:`nsel` command to select the nodes. Element numbers are + incremented by one from the highest previous element number. The element type must be set ( + :ref:`et` ) to a 2-node element before issuing this command. Use the :ref:`cpintf` command to + connect nodes by coupling instead of by elements. Use the :ref:`ceintf` command to connect the nodes + by constraint equations instead of by elements. + + For contact element ``CONTA178``, the tolerance is based on the maximum Cartesian coordinate + difference for node locations only. The angle differences for node orientations are not checked. + """ + command = f"EINTF,{toler},{k},{tlab},{kcn},{dx},{dy},{dz},{knonrot}" + return self.run(command, **kwargs) + + def elbow( + self, + transkey: str = "", + tol: str = "", + dof: str = "", + cons1: str = "", + cons2: str = "", + cons3: str = "", + cons4: str = "", + **kwargs, + ): + r"""Specifies degrees of freedom to be coupled for end release and applies section constraints to elbow + elements. + + Mechanical APDL Command: `ELBOW `_ + + Parameters + ---------- + transkey : str + Pipe-to-elbow transition flag: + + * ``OFF`` - Do not automatically transition pipes to elbows. (This behavior is the default.) + + * ``ON`` - Automatically convert straight ``PIPE289`` elements to ``ELBOW290`` elements where it is + beneficial. The program converts elements in transition regions where curved ``ELBOW290`` elements + are connected to straight ``PIPE289`` elements. + + tol : str + Angle tolerance (in degrees) between adjacent ``ELBOW290`` elements. The default value is 20. A + value of -1 specifies all selected ``ELBOW290`` elements. + + dof : str + Degrees of freedom to couple: + + * ``ALL`` - Couple all nodal degrees of freedom (UX, UY, UZ, ROTX, ROTY, and ROTZ). This behavior is + the default. + + * ``BALL`` - Create ball joints (equivalent to releasing ROTX, ROTY, and ROTZ). + + cons1 : str + Section degrees of freedoms to constrain. If ``Cons1`` through ``Cons4`` are unspecified, no section constraints are applied: + + * ``SECT`` - All section deformation + + * ``SE`` - Section radial expansion + + * ``SO`` - Section ovalization + + * ``SW`` - Section warping + + * ``SRA`` - Local shell normal rotation about cylindrical axis t2 + + * ``SRT`` - Local shell normal rotation about cylindrical axis t1 + + cons2 : str + Section degrees of freedoms to constrain. If ``Cons1`` through ``Cons4`` are unspecified, no section constraints are applied: + + * ``SECT`` - All section deformation + + * ``SE`` - Section radial expansion + + * ``SO`` - Section ovalization + + * ``SW`` - Section warping + + * ``SRA`` - Local shell normal rotation about cylindrical axis t2 + + * ``SRT`` - Local shell normal rotation about cylindrical axis t1 + + cons3 : str + Section degrees of freedoms to constrain. If ``Cons1`` through ``Cons4`` are unspecified, no section constraints are applied: + + * ``SECT`` - All section deformation + + * ``SE`` - Section radial expansion + + * ``SO`` - Section ovalization + + * ``SW`` - Section warping + + * ``SRA`` - Local shell normal rotation about cylindrical axis t2 + + * ``SRT`` - Local shell normal rotation about cylindrical axis t1 + + cons4 : str + Section degrees of freedoms to constrain. If ``Cons1`` through ``Cons4`` are unspecified, no section constraints are applied: + + * ``SECT`` - All section deformation + + * ``SE`` - Section radial expansion + + * ``SO`` - Section ovalization + + * ``SW`` - Section warping + + * ``SRA`` - Local shell normal rotation about cylindrical axis t2 + + * ``SRT`` - Local shell normal rotation about cylindrical axis t1 + + Notes + ----- + + .. _ELBOW_notes: + + The :ref:`elbow` command specifies end releases and section constraints for ``ELBOW290`` elements + and converts straight ``PIPE289`` elements to ``ELBOW290`` elements. + + Curved ``PIPE289`` elements are not converted to ``ELBOW290`` elements. + + ``ELBOW290`` elements are generated only if there are existing ``ELBOW290`` elements in the curved + areas. + + The command works on currently selected nodes and elements. It creates end releases on any two + connected elbow elements whose angle at connection exceeds the specified tolerance. From within the + GUI, the Picked node option generates an end release and section constraints at the selected node + regardless of the angle of connection (that is, the angle tolerance [ ``TOL`` ] is set to -1). + + + Elbow and pipe elements must share the same section ID in order for the pipe-to-elbow transition to + occur. + + To list the elements altered by the :ref:`elbow` command, issue an :ref:`elist` command. + + To list the coupled sets generated by the :ref:`elbow` command, issue a :ref:`cplist` command. + + To list the section constraints generated by the :ref:`elbow` command, issue a :ref:`dlist` command. + """ + command = f"ELBOW,{transkey},{tol},{dof},{cons1},{cons2},{cons3},{cons4}" + return self.run(command, **kwargs) + + def elist( + self, + iel1: str = "", + iel2: str = "", + inc: str = "", + nnkey: int | str = "", + rkey: int | str = "", + **kwargs, + ): + r"""Lists the elements and their attributes. + + Mechanical APDL Command: `ELIST `_ + + Parameters + ---------- + iel1 : str + Lists elements from ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in steps of ``INC`` (defaults + to 1). If ``IEL1`` = ALL (default), ``IEL2`` and ``INC`` are ignored and all selected elements ( + :ref:`esel` ) are listed. If ``IEL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``IEL1`` ( ``IEL2`` and ``INC`` are ignored). + + iel2 : str + Lists elements from ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in steps of ``INC`` (defaults + to 1). If ``IEL1`` = ALL (default), ``IEL2`` and ``INC`` are ignored and all selected elements ( + :ref:`esel` ) are listed. If ``IEL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``IEL1`` ( ``IEL2`` and ``INC`` are ignored). + + inc : str + Lists elements from ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in steps of ``INC`` (defaults + to 1). If ``IEL1`` = ALL (default), ``IEL2`` and ``INC`` are ignored and all selected elements ( + :ref:`esel` ) are listed. If ``IEL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``IEL1`` ( ``IEL2`` and ``INC`` are ignored). + + nnkey : int or str + Node listing key: + + * ``0`` - List attribute references and nodes. + + * ``1`` - List attribute references but not nodes. + + rkey : int or str + Real constant listing key: + + * ``0`` - Do not show real constants for each element. + + * ``1`` - Show real constants for each element. This includes default values chosen for the element. + + Notes + ----- + + .. _ELIST_notes: + + Lists the elements with their nodes and attributes (MAT, TYPE, REAL, ESYS, SECNUM, PART). See also + the :ref:`laylist` command for listing layered elements. + + This command is valid in any processor. + """ + command = f"ELIST,{iel1},{iel2},{inc},{nnkey},{rkey}" + return self.run(command, **kwargs) + + def emid(self, key: str = "", edges: str = "", **kwargs): + r"""Adds or removes midside nodes. + + Mechanical APDL Command: `EMID `_ + + Parameters + ---------- + key : str + Add or remove key: + + * ``ADD`` - Add midside node to elements (default). + + * ``REMOVE`` - Remove midside nodes from elements. + + edges : str + + * ``ALL`` - Add (or remove) midside nodes to (from) all edges of all selected elements, independent + of which nodes are selected (default). + + * ``EITHER`` - Add (or remove) midside nodes only to (from) element edges which have either corner + node selected. + + * ``BOTH`` - Add (or remove) midside nodes only to (from) element edges which have both corner nodes + selected. + + Notes + ----- + + .. _EMID_notes: + + This command adds midside nodes to (or removes midside nodes from) the selected elements. For this + to occur, the selected elements must be midside node capable, the active element type ( :ref:`type` + ) must allow midside node capability, and the relationship between the finite element model and the + solid model (if any) must first be disassociated ( :ref:`modmsh` ). + + By default, :ref:`emid` generates a midside node wherever a zero (or missing) midside node occurs + for that element. You can control this and add (or remove) midside nodes selectively by using the + ``Edges`` argument. Nodes are located midway between the two appropriate corner nodes based on a + linear Cartesian interpolation. Nodal coordinate system rotation angles are also linearly + interpolated. Connected elements share the same midside node. Node numbers are generated + sequentially from the maximum node number. + + The :ref:`emid` command is useful for transforming linear element types to quadratic element types + having the same corner node connectivity. + + :ref:`emid` is also useful for transforming elements created outside of the program. + """ + command = f"EMID,{key},{edges}" + return self.run(command, **kwargs) + + def emodif( + self, + iel: str = "", + stloc: str = "", + i1: str = "", + i2: str = "", + i3: str = "", + i4: str = "", + i5: str = "", + i6: str = "", + i7: str = "", + i8: str = "", + **kwargs, + ): + r"""Modifies a previously defined element. + + Mechanical APDL Command: `EMODIF `_ + + Parameters + ---------- + iel : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + stloc : str + Starting location ( ``n`` ) of first node to be modified or the attribute label. + + If ``n``, modify element node positions ``n``, ``n`` +1, etc. ( ``n`` = 1 to 20). For example, + if ``STLOC`` = 1, ``I1`` refers to the first node, ``I2``, the second, etc. If ``STLOC`` = 9, + ``I1`` refers to the ninth node, ``I2``, the tenth, etc. Attributes are also modified to the + currently specified values. + + Use - ``n`` to modify only nodes and not attributes. + + If zero, modify only the attributes to the currently specified values. + + If MAT, TYPE, REAL, ESYS, SECNUM, or EGID, modify only that attribute to the ``I1`` value. + + i1 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i2 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i3 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i4 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i5 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i6 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i7 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + i8 : str + Replace the previous node numbers assigned to this element with these corresponding values. A + (blank) retains the previous value (except in the ``I1`` field, which resets the ``STLOC`` node + number to zero). + + For attributes ( ``STLOC`` = MAT, TYPE, etc.), replace the existing value with the ``I1`` value + (or the default if ``I1`` is zero or blank). + + For attributes MAT and REAL, inputting the label GCN for ``I1`` replaces the existing attribute + value with zero for the specified elements. This is a special case used only for converting + contact elements ( ``TARGE169`` through ``CONTA177`` ) from a pair-based definition to a + `general contact definition + `_. + + Notes + ----- + + .. _EMODIF_notes: + + The nodes and/or attributes (MAT, TYPE, REAL, ESYS, SECNUM, or EGID values) of an existing element + can be changed with this command. + + The EGID attribute is valid only for ``MESH200`` elements when they are used to generate + `reinforcing + `_ + elements (REINF ``nnn`` ) via the `mesh-independent method + `_ for + defining reinforcing. + """ + command = f"EMODIF,{iel},{stloc},{i1},{i2},{i3},{i4},{i5},{i6},{i7},{i8}" + return self.run(command, **kwargs) + + def emore( + self, + q: str = "", + r: str = "", + s: str = "", + t: str = "", + u: str = "", + v: str = "", + w: str = "", + x: str = "", + **kwargs, + ): + r"""Adds more nodes to the just-defined element. + + Mechanical APDL Command: `EMORE `_ + + Parameters + ---------- + q : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + r : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + s : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + t : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + u : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + v : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + w : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + x : str + Numbers of nodes typically assigned to ninth (node ``Q`` ) through sixteenth (node ``X`` ) nodal + positions, if any. If ``Q`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + Notes + ----- + + .. _EMORE_notes: + + Repeat :ref:`emore` command for up to 4 additional nodes (20 maximum). Nodes are added after the + last nonzero node of the element. Node numbers defined with this command may be zeroes. + """ + command = f"EMORE,{q},{r},{s},{t},{u},{v},{w},{x}" + return self.run(command, **kwargs) + + def emsel( + self, type_: str = "", vmin: str = "", vmax: str = "", vinc: str = "", **kwargs + ): + r"""Selects a group of `reinforcing + `_ + members via a predefined global identifier. + + Mechanical APDL Command: `EMSEL `_ + + Parameters + ---------- + type_ : str + Specifies the selection type for the reinforcing elements: + + * S - Select a new set (default). + * A - Select an additional set and add it to the current set. + * U - Unselect a set from the current set. + * ALL - Restore the full set. + * STAT - Display the current selection status. + + The following arguments are valid only when ``Type`` = S, A, or U: + + vmin : str + Minimum value of a group-identifier range. + + vmax : str + Maximum value of global identifier range. Default = VMIN for input values. + + vinc : str + Value increment within the specified range. Default = 1. + + Notes + ----- + Understanding Reinforcing Member Groups When using the `mesh-independent method + `_ for + defining reinforcing, the global identifier for a set of ``MESH200`` elements (specified via + :ref:`egid` ) is transferred from the ``MESH200`` elements to the reinforcing members (individual + reinforcings) when the reinforcing elements (REINF ``nnn`` ) are generated ( :ref:`ereinf` ). + + The :ref:`emsel` command selects groups of reinforcing members (individual reinforcings) via + specified global identifiers. + + **Example: Selecting Reinforcing Member Groups** + + The following command selects a new group of reinforcing members based on global identifiers 1 + through 7: + + .. code:: apdl + + EMSEL,S,,,1,7 + + ``VMIN``, ``VMAX``, and ``VINC`` are positive integer values. + + This command is valid in PREP7 and POST1. + + For more information about using this command in a mesh-independent reinforcing analysis, see + `Selecting and Displaying Groups of Reinforcing Members + `_ + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + """ + command = f"EMSEL,{type_},,,{vmin},{vmax},{vinc}" + return self.run(command, **kwargs) + + def emtgen( + self, + ncomp: str = "", + ecomp: str = "", + pncomp: str = "", + dof: str = "", + gap: str = "", + gapmin: str = "", + fkn: str = "", + epzero: str = "", + smethod: str = "", + **kwargs, + ): + r"""Generates a set of ``TRANS126`` elements. + + Mechanical APDL Command: `EMTGEN `_ + + Parameters + ---------- + ncomp : str + Component name of the surface nodes of a structure which attach to the ``TRANS126`` elements. + The component name must be 32 characters or less, and you must enclose the name in single quotes + in the :ref:`emtgen` command line. + + ecomp : str + Component name of the ``TRANS126`` elements generated. The component name must be 32 characters + or less, and you must enclose the name in single quotes in the :ref:`emtgen` command line. + Defaults to EMTELM. + + pncomp : str + Component name of the plane nodes generated by the command at an offset ( ``GAP`` ) from the + surface nodes. The component name must be 32 characters or less, and you must enclose the name + in single quotes in the :ref:`emtgen` command line. Defaults to EMTPNO. + + dof : str + Active structural degree of freedom (DOF) for ``TRANS126`` elements in the Cartesian coordinate system. You must enclose the DOF label in single quotes: + + * ``UX`` - Displacement in X direction. + + * ``UY`` - Displacement in Y direction. + + * ``UZ`` - Displacement in Z direction. + + gap : str + Initial gap distance from the surface nodes to the plane. Be sure to use the correct sign with + respect to Ncomp node location. + + gapmin : str + Minimum gap distance allowed (GAPMIN real constant) for ``TRANS126`` elements. Defaults to the + absolute value of ( ``GAP`` )\*0.05. + + fkn : str + Contact stiffness factor used as a multiplier for a contact stiffness appropriate for bulk + deformation. Defaults to 0.1. A negative value is interpreted as the modulus of elasticity on + which the contact stiffness will be based. + + epzero : str + Free-space permittivity. Defaults to 8.854e-6 (μMKS units). + + smethod : str + Stiffness method for ``TRANS126`` elements (KEYOPT(6) setting). You must enclose the following labels in single quotes: + + * ``AUGM`` - Augmented stiffness method (default). + + * ``FULL`` - Full stiffness method. This method must be used in a linear perturbation harmonic + analysis. + + Notes + ----- + + .. _EMTGEN_notes: + + The :ref:`emtgen` command generates a set of ``TRANS126`` elements between the surface nodes of a + moveable structure and a plane of nodes, typically representing a ground plane. The plane of nodes + is created by the command at a specified offset ( ``GAP`` ). Each element attaches to a surface node + and to a corresponding node representing the plane. The generated plane nodes should be constrained + appropriately for the analysis. + + By default, the created elements use the augmented stiffness method (KEYOPT(6) = 1), which can help + convergence. You can change to the full stiffness method (KEYOPT(6) = 0) by setting ``Smethod`` = + FULL. The full stiffness method is required for a linear perturbation harmonic analysis. + + You can use ``TRANS126`` elements for simulating fully coupled electrostatic structural coupling + between a MEMS device and a plane, if the gap distance between the device and the plane is small + compared to the overall surface area dimensions of the device. This assumption allows for a point- + wise closed-form solution of capacitance between the surface nodes and the plane; i.e. CAP = + EPZERO\2AREA/GAP, where EPZERO if the free-space permittivity, AREA is the area associated with the + node, and GAP is the gap between the node and the plane. The area for each node is computed using + the ARNODE function. See the :ref:`get` command description for more information on the ARNODE + function. + + With a distributed set of ``TRANS126`` elements attached directly to the structure and a plane (such + as a ground plane), you can perform a full range of coupled electrostatic-structural simulations, + including: + + * Static analysis (due to a DC voltage or a mechanical load) + + * Prestressed modal analysis (eigenfrequencies, including frequency-shift effects of a DC bias + voltage) + + * Prestressed harmonic analysis (system response to a small-signal AC excitation with a DC bias + voltage or mechanical load) + + * Large signal transient analysis (time-transient solution due to an arbitrary time-varying voltage + or mechanical excitation) + + The ``TRANS126`` element also employs a node-to-node gap feature so you can perform contact-type + simulations where the structure contacts a plane (such as a ground plane). The contact stiffness + factor, FKN, is used to control contact penetration once contact is initiated. A smaller value + provides for easier convergence, but with more penetration. + """ + command = f"EMTGEN,{ncomp},{ecomp},{pncomp},{dof},{gap},{gapmin},{fkn},{epzero},,{smethod}" + return self.run(command, **kwargs) + + def en( + self, + iel: str = "", + i: str = "", + j: str = "", + k: str = "", + l: str = "", + m: str = "", + n: str = "", + o: str = "", + p: str = "", + **kwargs, + ): + r"""Defines an element by its number and node connectivity. + + Mechanical APDL Command: `EN `_ + + Parameters + ---------- + iel : str + Number assigned to element being defined. If ``IEL`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). + + i : str + Number of node assigned to first nodal position (node I). + + j : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + k : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + l : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + m : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + n : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + o : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + p : str + Number assigned to second (node J) through eighth (node P) nodal position, if any. + + Notes + ----- + + .. _EN_notes: + + Defines an element by its nodes and attribute values. Similar to the :ref:`e` command except it + allows the element number ( ``IEL`` ) to be defined explicitly. Element numbers need not be + consecutive. Any existing element already having this number will be redefined. + + Up to 8 nodes may be specified with the :ref:`en` command. If more nodes are needed for the element, + use the :ref:`emore` command. The number of nodes required and the order in which they should be + specified are described in the `Element Reference + `_ for each + element type. The current (or default) MAT, TYPE, + REAL, SECNUM, and ESYS attribute values are also assigned to the element. + + When creating elements with more than 8 nodes using this command and the :ref:`emore` command, it + may be necessary to turn off shape checking using the :ref:`shpp` command before issuing this + command. If a valid element type can be created without using the additional nodes on the + :ref:`emore` command, this command will create that element. The :ref:`emore` command will then + modify the element to include the additional nodes. If shape checking is active, it will be + performed before the :ref:`emore` command is issued. Therefore, if the shape checking limits are + exceeded, element creation may fail before the :ref:`emore` command modifies the element into an + acceptable shape. + """ + command = f"EN,{iel},{i},{j},{k},{l},{m},{n},{o},{p}" + return self.run(command, **kwargs) + + def endrelease( + self, + tolerance: str = "", + dof1: str = "", + dof2: str = "", + dof3: str = "", + dof4: str = "", + kjct: str = "", + kcheck: str = "", + **kwargs, + ): + r"""Specifies degrees of freedom to be decoupled for end release. + + Mechanical APDL Command: `ENDRELEASE `_ + + Parameters + ---------- + + tolerance : str + Angle tolerance (in degrees) between adjacent elements ( ``KCHECK`` = 0), or a percentage + tolerance value for comparing cross-section properties between adjacent elements ( ``KCHECK`` = + 1). Default = 20. + + To release all selected elements, set ``TOLERANCE`` = -1. + + See :ref:`ENDRELEASE_notes` for information about using this argument with ``KCHECK``. + + dof1 : str + Degrees of freedom to release. If ``Dof1`` is blank, WARP is assumed and ``Dof2``, ``Dof3``, and + ``Dof4`` are ignored. + + * ``WARP`` - Release the warping degree of freedom (default). + + * ``ROTX`` - Release rotations in the X direction. + + * ``ROTY`` - Release rotations in the Y direction. + + * ``ROTZ`` - Release rotations in the Z direction. + + * ``UX`` - Release displacements in the X direction. + + * ``UY`` - Release displacements in the Y direction. + + * ``UZ`` - Release displacements in the Z direction. + + * ``BALL`` - Create ball joints (equivalent to releasing WARP, ROTX, ROTY, and ROTZ). + + dof2 : str + Degrees of freedom to release. If ``Dof1`` is blank, WARP is assumed and ``Dof2``, ``Dof3``, and + ``Dof4`` are ignored. + + * ``WARP`` - Release the warping degree of freedom (default). + + * ``ROTX`` - Release rotations in the X direction. + + * ``ROTY`` - Release rotations in the Y direction. + + * ``ROTZ`` - Release rotations in the Z direction. + + * ``UX`` - Release displacements in the X direction. + + * ``UY`` - Release displacements in the Y direction. + + * ``UZ`` - Release displacements in the Z direction. + + * ``BALL`` - Create ball joints (equivalent to releasing WARP, ROTX, ROTY, and ROTZ). + + dof3 : str + Degrees of freedom to release. If ``Dof1`` is blank, WARP is assumed and ``Dof2``, ``Dof3``, and + ``Dof4`` are ignored. + + * ``WARP`` - Release the warping degree of freedom (default). + + * ``ROTX`` - Release rotations in the X direction. + + * ``ROTY`` - Release rotations in the Y direction. + + * ``ROTZ`` - Release rotations in the Z direction. + + * ``UX`` - Release displacements in the X direction. + + * ``UY`` - Release displacements in the Y direction. + + * ``UZ`` - Release displacements in the Z direction. + + * ``BALL`` - Create ball joints (equivalent to releasing WARP, ROTX, ROTY, and ROTZ). + + dof4 : str + Degrees of freedom to release. If ``Dof1`` is blank, WARP is assumed and ``Dof2``, ``Dof3``, and + ``Dof4`` are ignored. + + * ``WARP`` - Release the warping degree of freedom (default). + + * ``ROTX`` - Release rotations in the X direction. + + * ``ROTY`` - Release rotations in the Y direction. + + * ``ROTZ`` - Release rotations in the Z direction. + + * ``UX`` - Release displacements in the X direction. + + * ``UY`` - Release displacements in the Y direction. + + * ``UZ`` - Release displacements in the Z direction. + + * ``BALL`` - Create ball joints (equivalent to releasing WARP, ROTX, ROTY, and ROTZ). + + kjct : str + Behavior at a junction node (a node shared by more than two elements): + + * 0 (or blank) - Release all elements. ``TOLERANCE`` is ignored. + * 1 - Release noncontinuous elements (if only one pair of continuous elements exists). + + This argument is ignored (due to ambiguity) if ``KJCT`` = 1 and multiple pairs of continuous + elements exist. + + This argument is ignored if ``TOLERANCE`` = -1. + + kcheck : str + Controls how connected elements are checked at selected nodes. + + * 0 (or blank) - Check only the angle between connected elements at the selected nodes (default). + * 1 - Check the angle and other cross-section properties (including offsets and orientations) + between connected elements at the selected nodes. + + This argument is ignored if ``TOLERANCE`` = -1. + + Notes + ----- + + .. _ENDRELEASE_notes: + + :ref:`endrelease` specifies end releases for the ``BEAM188``, ``BEAM189``, ``PIPE288``, and + ``PIPE289`` elements. The command works on currently selected nodes and elements. + + Depending on the specified ``KCHECK``, the command generates end releases on any two connected + elements whose angle at the connection is > ``TOLERANCE``, or whose cross-section properties have a + difference > ``TOLERANCE`` percent. + + From within the GUI, the Picked node option (equivalent to ``TOLERANCE`` = -1) generates an end + release at the selected node regardless of the angle of connection or cross-section properties. + + When ``KCHECK`` = 1: + + * The specified ``TOLERANCE`` serves as a percentage for comparing cross-section properties between + adjacent elements. (For example, if using the default ``TOLERANCE`` = 20, the tolerance is + considered to be 20 percent.) + + * In addition to the angle between connected elements, the section integrated properties (such as + area, Iyy, Iyz, Izz, warping constant, and torsion constant), offsets, and cross-section + orientations are also compared at the selected nodes. If the difference in any of the properties + (or angles) is > ``TOLERANCE``, the requested degrees of freedom are released for those nodes. + + * For comparing cross-section orientations, the Y axes of cross-sections are compared after being + projected onto the middle plane (the plane having a normal vector equal to the average of element + X axes). + + * For comparing offsets, the differences in the centers of cross-sections are compared against the + approximate maximum section size of the connected elements. + + Examples: End-Release Conditions at a Junction Node when KJCT= 1 and KCHECK= 0 + ****************************************************************************** + + .. flat-table:: + :header-rows: 1 + + * - Example Junction Node (E - Element) + - Behavior + * - + - E2 is not released. E3 is released. A new node is generated for E3. + * - + - E2 and E3 are released if the angles between E1-E2 and E1-E3 are within tolerance (two continuous pairs). + * - + - E2, E3, and E4 are released regardless of ``KJCT`` (two continuous pairs). + * - + - E4 is not released. E2 and E3 are released. New nodes are generated for E2 and E3. + + Examples: Using KCHECKwith TOLERANCE= 20 + **************************************** + + .. flat-table:: + :header-rows: 1 + + * - Example (E - Element, N - Node) + - Behavior when ``KCHECK`` = 0 + - Behavior when ``KCHECK`` = 1 + * - + - E1 and E2 are connected at an angle > 20°, so an end release is generated at N2. + - E1 and E2 have the same section properties but are connected at an angle > 20°, so an end release is generated at N2. + * - + - E3 and E4 are continuous (angle between them is < 20°), so an end release is not generated at N4. + - E3 and E4 use different beam sections, so an end release is generated at N4. + * - + - E5 and E6 are continuous (angle between them is less than 20°), so an end release is not generated at N6. + - The difference between the section properties of E5 and E6 is > 20%, so an end release is generated at N6. + * - + - E7 and E8 are continuous (angle between them are < 20°), so an end release is not generated at N8. + - The difference between the section offsets of E7 and E8 is > 20%, so an end release is generated at N8. + * - + - E9 and E10 are continuous (angle between them is < 20°), so an end release is not generated at N10. + - The difference between the cross-section orientations of E9 and E10 is > 20°, so an end release is generated at N10. + + To list the coupled sets generated by this command, issue :ref:`cplist`. + + Exercise engineering judgement when using this command. Improper use may result in mechanics that + render a solution impossible. + """ + command = f"ENDRELEASE,,{tolerance},{dof1},{dof2},{dof3},{dof4},{kjct},{kcheck}" + return self.run(command, **kwargs) + + def engen( + self, + iinc: str = "", + itime: str = "", + ninc: str = "", + iel1: str = "", + iel2: str = "", + ieinc: str = "", + minc: str = "", + tinc: str = "", + rinc: str = "", + cinc: str = "", + sinc: str = "", + dx: str = "", + dy: str = "", + dz: str = "", + **kwargs, + ): + r"""Generates elements from an existing pattern. + + Mechanical APDL Command: `ENGEN `_ + + Parameters + ---------- + iinc : str + Increment to be added to element numbers in pattern. + + itime : str + Do this generation operation a total of ``ITIME`` s, incrementing all nodes in the given pattern + by ``NINC`` each time after the first. ``ITIME`` must be > 1 if generation is to occur. ``NINC`` + may be positive, zero, or negative. + + ninc : str + Do this generation operation a total of ``ITIME`` s, incrementing all nodes in the given pattern + by ``NINC`` each time after the first. ``ITIME`` must be > 1 if generation is to occur. ``NINC`` + may be positive, zero, or negative. + + iel1 : str + Generate elements from the pattern that begins with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) + in steps of ``IEINC`` (defaults to 1). If ``IEL1`` is negative, ``IEL2`` and ``IEINC`` are + ignored and use the last \| ``IEL1`` \| elements (in sequence backward from the maximum element + number) as the pattern to be repeated. If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + all selected elements ( :ref:`esel` ) are used as the pattern to be repeated. If ``IEL1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). A component name may also be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are + ignored). + + iel2 : str + Generate elements from the pattern that begins with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) + in steps of ``IEINC`` (defaults to 1). If ``IEL1`` is negative, ``IEL2`` and ``IEINC`` are + ignored and use the last \| ``IEL1`` \| elements (in sequence backward from the maximum element + number) as the pattern to be repeated. If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + all selected elements ( :ref:`esel` ) are used as the pattern to be repeated. If ``IEL1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). A component name may also be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are + ignored). + + ieinc : str + Generate elements from the pattern that begins with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) + in steps of ``IEINC`` (defaults to 1). If ``IEL1`` is negative, ``IEL2`` and ``IEINC`` are + ignored and use the last \| ``IEL1`` \| elements (in sequence backward from the maximum element + number) as the pattern to be repeated. If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + all selected elements ( :ref:`esel` ) are used as the pattern to be repeated. If ``IEL1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). A component name may also be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are + ignored). + + minc : str + Increment material number of all elements in the given pattern by ``MINC`` each time after the + first. + + tinc : str + Increment type number by ``TINC``. + + rinc : str + Increment real constant table number by ``RINC``. + + cinc : str + Increment element coordinate system number by ``CINC``. + + sinc : str + Increment section ID number by ``SINC``. + + dx : str + Define nodes that do not already exist but are needed by generated elements ( :ref:`ngen`, + ``ITIME,INC,NODE1,,,DX,DY,DZ`` ). Zero is a valid value. If blank, ``DX``, ``DY``, and ``DZ`` + are ignored. + + dy : str + Define nodes that do not already exist but are needed by generated elements ( :ref:`ngen`, + ``ITIME,INC,NODE1,,,DX,DY,DZ`` ). Zero is a valid value. If blank, ``DX``, ``DY``, and ``DZ`` + are ignored. + + dz : str + Define nodes that do not already exist but are needed by generated elements ( :ref:`ngen`, + ``ITIME,INC,NODE1,,,DX,DY,DZ`` ). Zero is a valid value. If blank, ``DX``, ``DY``, and ``DZ`` + are ignored. + + Notes + ----- + + .. _ENGEN_notes: + + Same as the :ref:`egen` command except it allows element numbers to be explicitly incremented ( + ``IINC`` ) from the generated set. Any existing elements already having these numbers will be + redefined. + """ + command = f"ENGEN,{iinc},{itime},{ninc},{iel1},{iel2},{ieinc},{minc},{tinc},{rinc},{cinc},{sinc},{dx},{dy},{dz}" + return self.run(command, **kwargs) + + def enorm(self, enum: str = "", **kwargs): + r"""Reorients shell element normals or line element node connectivity. + + Mechanical APDL Command: `ENORM `_ + + Parameters + ---------- + enum : str + Element number having the normal direction that the reoriented elements are to match. If + ``ENUM`` = P, graphical picking is enabled and all remaining command fields are ignored (valid + only in the GUI). + + Notes + ----- + + .. _ENORM_notes: + + Reorients shell elements so that their outward normals are consistent with that of a specified + element. :ref:`enorm` can also be used to reorder nodal connectivity of line elements so that their + nodal ordering is consistent with that of a specified element. + + For shell elements, the operation reorients the element by reversing and shifting the node + connectivity pattern. For example, for a 4-node shell element, the nodes in positions I, J, K and L + of the original element are placed in positions J, I, L and K of the reoriented element. All 3D + shell elements in the selected set are considered for reorientation, and no element is reoriented + more than once during the operation. Only shell elements adjacent to the lateral (side) faces are + considered. + + The command reorients the shell element normals on the same panel as the specified shell element. A + panel is the geometry defined by a subset of shell elements bounded by free edges or T-junctions + (anywhere three or more shell edges share common nodes). + + Reorientation progresses within the selected set until either of the following conditions is true: + + * The edge of the model is reached. + + * More than two elements (whether selected or unselected) are adjacent to a lateral face. + + In situations where unselected elements might undesirably cause case b to control, consider using + :ref:`ensym`,0,,0,ALL instead of :ref:`enorm`. It is recommended that reoriented elements be displayed and graphically reviewed. + + You cannot use the :ref:`enorm` command to change the normal direction of any element that has a + body or surface load. We recommend that you apply all of your loads only after ensuring that the + element normal directions are acceptable. + + Real constant values are not reoriented and may be invalidated by an element reversal. + """ + command = f"ENORM,{enum}" + return self.run(command, **kwargs) + + def ensym( + self, + iinc: str = "", + ninc: str = "", + iel1: str = "", + iel2: str = "", + ieinc: str = "", + **kwargs, + ): + r"""Generates elements by symmetry reflection. + + Mechanical APDL Command: `ENSYM `_ + + Parameters + ---------- + iinc : str + Increment to be added to element numbers in existing set. + + ninc : str + Increment nodes in the given pattern by ``NINC``. + + iel1 : str + Reflect elements from pattern beginning with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in + steps of ``IEINC`` (defaults to 1). If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + pattern is all selected elements ( :ref:`esel` ). If ``IEL1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are ignored). + + iel2 : str + Reflect elements from pattern beginning with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in + steps of ``IEINC`` (defaults to 1). If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + pattern is all selected elements ( :ref:`esel` ). If ``IEL1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are ignored). + + ieinc : str + Reflect elements from pattern beginning with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in + steps of ``IEINC`` (defaults to 1). If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + pattern is all selected elements ( :ref:`esel` ). If ``IEL1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are ignored). + + Notes + ----- + + .. _ENSYM_notes: + + The :ref:`ensym` command is similar to the :ref:`esym` command except that it enables explicitly + assigned element numbers to the generated set (in terms of an increment ``IINC`` ). Any existing + elements already having these numbers are redefined. + + The operation generates a new element by incrementing the nodes on the original element, and + reversing and shifting the node connectivity pattern. For example, for a 4-node 2D element, the + nodes in positions I, J, K and L of the original element are placed in positions J, I, L and K of + the reflected element. + + Similar permutations occur for all other element types. For line elements, the nodes in positions I + and J of the original element are placed in positions J and I of the reflected element. + + See the :ref:`esym` command for additional information about symmetry elements. + + This command also provides a convenient way to reverse shell element normals. If the ``IINC`` and + ``NINC`` argument fields are left blank, the effect of the reflection is to reverse the direction of + the outward normal of the specified elements. You cannot use this command to change the normal + direction of any element that has a body or surface load. It is best to apply all loading only after + ensuring that the element normal directions are acceptable. + + Real constants (such as nonuniform shell thickness and tapered beam constants) may be invalidated by + an element reversal. + + For more information about controlling element normals, see `Revising Your Model + `_. + """ + command = f"ENSYM,{iinc},,{ninc},{iel1},{iel2},{ieinc}" + return self.run(command, **kwargs) + + def eplot(self, **kwargs): + r"""Produces an element display. + + Mechanical APDL Command: `EPLOT `_ + + Notes + ----- + + .. _EPLOT_notes: + + Produces an element display of the selected elements. In full graphics, only those elements faces + with all of their corresponding nodes selected are plotted. In PowerGraphics, all element faces of + the selected element set are plotted irrespective of the nodes selected. However, for both full + graphics and PowerGraphics, adjacent or otherwise duplicated faces of 3D solid elements will not be + displayed in an attempt to eliminate plotting of interior facets. See the :ref:`dsys` command for + display coordinate system issues. + + This command will display curvature in midside node elements when PowerGraphics is activated ( + :ref:`graphics` ,POWER) and :ref:`efacet`,2 or :ref:`efacet`,4 are enabled. (To display curvature, + two facets per edge is recommended ( :ref:`efacet`,2)). When you specify :ref:`efacet`,1, + PowerGraphics does not display midside nodes. :ref:`efacet` has no effect on :ref:`eplot` for non- + midside node elements. + + This command is valid in any processor. + """ + command = "EPLOT" + return self.run(command, **kwargs) + + def eread(self, fname: str = "", ext: str = "", **kwargs): + r"""Reads elements from a file. + + Mechanical APDL Command: `EREAD `_ + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to ELEM if ``Fname`` is + blank. + + Notes + ----- + + .. _EREAD_notes: + + This read operation is not necessary in a standard anlaysis run but is provided as a convenience for + those wanting to read a coded element file, such as from another mesh generator or from a CAD/CAM + program. + + Data should be formatted as generated via :ref:`ewrite`. + + If issuing :ref:`eread` to acquire element information generated from :ref:`ewrite`, you must also + issue :ref:`nread` before the :ref:`eread` command. The element types ( :ref:`et` ) must be defined + before the file is read so that the file may be read properly. Only elements that are specified via + :ref:`errang` are read from the file. Also, only elements that are fully attached to the nodes + specified via :ref:`nrrang` are read from the file. + + Elements are assigned numbers consecutively as read from the file, beginning with the current + highest database element number plus one. The file is rewound before and after reading. Reading + continues until the end of the file. + """ + command = f"EREAD,{fname},{ext}" + return self.run(command, **kwargs) + + def ereinf(self, koffalim: str = "", ktri: str = "", **kwargs): + r"""Generates reinforcing elements from selected existing (base) elements. + + Mechanical APDL Command: `EREINF `_ + + Parameters + ---------- + koffalim : str + Enable or disable the limit of the angle between a ``MESH200`` element and a base element. Valid for + the `mesh-independent method + `_ only. + + * 0 - Enable the angle limit (default). + * 1 - Disable the angle limit. + + ktri : str + Specify the shape of 3D smeared reinforcing members. Valid for the `mesh-independent method + `_ only. + + * 0 - Generate quad-dominant (mixed quadrilateral and triangular) reinforcing members (default). + * 1 - Generate triangular reinforcing members only. + + Notes + ----- + :ref:`ereinf` generates reinforcing elements ( ``REINF263``, ``REINF264`` and ``REINF265`` ) + directly from selected base elements (that is, existing standard structural elements in your model). + The command scans all selected base elements and generates (if necessary) a compatible reinforcing + element type for each base element. (You can select a combination of different base element types.) + + Before issuing :ref:`ereinf`, first define the reinforcing geometry, material, and orientation via + one of two methods: + + `Mesh-Independent Method: + `_ Use + ``MESH200`` elements to temporarily represent the geometry of the reinforcing fibers or smeared + reinforcing surfaces. Define additional data including material, fiber cross-section area, fiber + spacing, and fiber orientation via reinforcing sections with the mesh pattern ( :ref:`secdata` ) and + assign the sections to corresponding ``MESH200`` elements. (Predefining the reinforcing element type + ( :ref:`et` ) is not required.) + + `Standard Method: + `_ Define + reinforcing section types ( :ref:`sectype` ) with standard reinforcing location patterns ( + :ref:`secdata` ). The standard reinforcing location input are given with respect to the selected + base elements; therefore, a change in the base mesh may require redefining the (mesh-dependent) + reinforcing section types. + + Standard element-definition commands (such as :ref:`et` and :ref:`e` ) are not used for defining + reinforcing elements. + + :ref:`ereinf` creates no new nodes. The reinforcing elements and the base elements share the common + nodes. + + Elements generated by :ref:`ereinf` are not associated with the solid model. + + After :ref:`ereinf` executes, you can issue :ref:`etlist`, :ref:`elist`, or :ref:`eplot` to verify + the newly created reinforcing element types and elements. + + Reinforcing elements do not account for any subsequent modifications made to the base elements. + Ansys, Inc. recommends issuing :ref:`ereinf` only after the base elements are finalized. If + you delete or modify base elements (via :ref:`edele`, :ref:`emodif`, :ref:`etchg`, :ref:`emid`, + :ref:`eorient`, :ref:`nummrg`, or :ref:`numcmp`, for example), remove all affected reinforcing + elements and reissue :ref:`ereinf` to avoid inconsistencies. + + If you define reinforcing via the `mesh-independent method + `_, + :ref:`ereinf` creates new reinforcing sections containing details of the created reinforcing + elements, then applies them to all newly generated reinforcing elements. The number of new + reinforcing sections depends on the number of new reinforcing elements. (You can examine the + properties of new sections ( :ref:`slist` ).) The program sets the ID number of the newest + reinforcing section to the highest section ID number in the model. After issuing :ref:`ereinf`, the + command shows the highest-numbered IDs (element type, element, and section). Do not overwrite a new + reinforcing section when defining subsequent sections. + + For the 3D smeared-reinforcing element ( ``REINF265`` ) with the `mesh-independent method + `_, you can + select the shape of the reinforcing members via ``KTri``. The default behavior ( ``KTri`` = 0) + generates quad-dominant members (primarily quadrilaterals but with some triangles). + + :ref:`ereinf` can generate the reinforcing elements with thermal properties if the base elements are + thermal solid elements ( ``SOLID278`` or ``SOLID279`` ): + + * If using the `mesh-independent method + `_ for + defining reinforcing, apply element body-force loading ( :ref:`bfe`,,HGEN) or nodal body-force + loading ( :ref:`bf`,,HGEN) on the ``MESH200`` elements. + + * If using the `standard method + `_ for + defining reinforcing, apply element body-force loading ( :ref:`bfe`,,HGEN) on the reinforcing + members directly. (Do not apply nodal body-force loading ( :ref:`bf`,,HGEN).) + + If performing a subsequent structural analysis after the thermal analysis, :ref:`ereinf` can convert + the reinforcing elements for the structural analysis: Convert the thermal base elements to the + appropriate structural element ( :ref:`et` or :ref:`emodif` ). + + Select the reinforcing elements only. + + Issue :ref:`ereinf`. + + Result : The selected reinforcing elements are converted to elements compatible with the converted + base elements. + + Solution accuracy can be affected if the volume ratio between reinforcing elements and base elements + is high, particularly when body loading (such as heat generation) is applied via the reinforcing + elements. If the program detects a high volume ratio of reinforcing elements generated via the + `mesh-independent method + `_, it issues + a warning message and saves affected base and ``MESH200`` elements (used to generate the reinforcing + elements) into a component for close model inspection. Only the volume of reinforcing elements + created by the current :ref:`ereinf` command is considered in the volume-ratio calculation (that + is, no volume accumulation occurs over multiple :ref:`ereinf` commands). + + For more information, see `Element Embedding + `_ + """ + command = f"EREINF,{koffalim},{ktri}" + return self.run(command, **kwargs) + + def errang(self, emin: str = "", emax: str = "", einc: str = "", **kwargs): + r"""Specifies the element range to be read from a file. + + Mechanical APDL Command: `ERRANG `_ + + Parameters + ---------- + emin : str + Elements with numbers from ``EMIN`` (defaults to 1) to ``EMAX`` (defaults to 999999999) in steps + of ``EINC`` (defaults to 1) will be read. + + emax : str + Elements with numbers from ``EMIN`` (defaults to 1) to ``EMAX`` (defaults to 999999999) in steps + of ``EINC`` (defaults to 1) will be read. + + einc : str + Elements with numbers from ``EMIN`` (defaults to 1) to ``EMAX`` (defaults to 999999999) in steps + of ``EINC`` (defaults to 1) will be read. + + Notes + ----- + + .. _ERRANG_notes: + + Defines the element number range to be read ( :ref:`eread` ) from the element file. If a range is + also implied from the :ref:`nrrang` command, only those elements satisfying both ranges will be + read. + """ + command = f"ERRANG,{emin},{emax},{einc}" + return self.run(command, **kwargs) + + def esurf(self, xnode: str = "", tlab: str = "", shape: str = "", **kwargs): + r"""Generates elements overlaid on the free faces of selected nodes. + + Mechanical APDL Command: `ESURF `_ + + Parameters + ---------- + xnode : str + Node number that is used only in the following two cases: + + * ``XNODE`` is a single extra node number (ID) used for generating SURF151 or SURF152 elements when + KEYOPT(5)=1. + * ``XNODE`` is a single pressure node number (ID) used for generating ``HSFLD241`` or ``HSFLD242`` + elements. + + There is no default. ``XNODE`` must be specified for the above cases. If ``XNODE`` = P, graphical + picking is enabled and all remaining command fields are ignored (valid only in the GUI). A parameter + or parametric expression can be substituted for ``XNODE``. + + tlab : str + Generates target, contact, and hydrostatic fluid elements with correct direction of normals. + + This option is valid only with ``TARGE169``, ``TARGE170``, ``CONTA172``, ``CONTA174``, ``CONTA177``, ``HSFLD241``, and ``HSFLD242`` elements. + + * ``TOP`` - Generates target and contact elements over beam and shell elements, or hydrostatic fluid + elements over shell elements, with the normals the same as the underlying beam and shell elements + (default). + + * ``BOTTOM`` - Generates target and contact elements over beam and shell elements, or hydrostatic + fluid elements over shell elements, with the normals opposite to the underlying beam and shell + elements. + + If target or contact elements and hydrostatic fluid elements are defined on the same underlying + shell elements, you only need to use this option once to orient the normals opposite to the + underlying shell elements. + + * ``REVERSE`` - Reverses the direction of the normals on existing selected target elements, contact + elements, and hydrostatic fluid elements. + + If target or contact elements and hydrostatic fluid elements are defined on the same underlying + shell elements, you only need to use this option once to reverse the normals for all selected + elements. + + shape : str + Used to specify the element shape for target element ``TARGE170`` ( ``Shape`` = LINE or POINT) or ``TARGE169`` elements ( ``Shape`` = POINT). + + * ``(blank)`` - The target element takes the same shape as the external surface of the underlying + element (default). + + * ``LINE`` - Generates LINE or PARA (parabolic) segments on exterior of selected 3D elements. + + * ``POINT`` - Generates POINT segments on selected nodes. + + Notes + ----- + + .. _ESURF_notes: + + The :ref:`esurf` command generates elements of the currently active element type overlaid on the + free faces of existing elements. For example, surface elements (such as ``SURF151``, ``SURF152``, + ``SURF153``, ``SURF154``, or ``SURF159`` ) can be generated over solid elements (such as + ``PLANE55``, ``SOLID70``, ``PLANE182``, ``SOLID185``, or ``SOLID272``, respectively). + + Element faces are determined from the selected node set ( :ref:`nsel` ) and the load faces for that + element type. The operation is similar to that used for generating element loads from selected nodes + via the :ref:`sf`,ALL command, except that elements (instead of loads) are generated. All nodes on + the face must be selected for the face to be used. For shell elements, only face one of the element + is available. If nodes are shared by adjacent selected element faces, the faces are not free and no + element is generated. + + Elements created by :ref:`esurf` are oriented such that their surface load directions are consistent + with those of the underlying elements. Carefully check generated elements and their orientations. + + Generated elements use the existing nodes and the active :ref:`mat`, :ref:`type`, :ref:`real`, and + :ref:`esys` attributes. The exception is when ``Tlab`` = REVERSE. The reversed target and contact + elements have the same attributes as the original elements. If the underlying elements are solid + elements, ``Tlab`` = TOP or BOTTOM has no effect. + + When the command generates a target element, the shape is by default the same as that of the + underlying element. Issue :ref:`esurf`,,,LINE or :ref:`esurf`,,,POINT to generate LINE, PARA, and + POINT segments. + + The :ref:`esurf` command can also generate the 2D or 3D node-to-surface element ``CONTA175``, based + on the selected node components of the underlying solid elements. When used to generate ``CONTA175`` + elements, all :ref:`esurf` arguments are ignored. (If ``CONTA175`` is the active element type, the + path Main Menu> Preprocessor> Modeling> Create> Elements> Node-to-Surf uses :ref:`esurf` to generate + elements.) + + To generate ``SURF151`` or ``SURF152`` elements that have two extra nodes from ``FLUID116`` + elements, KEYOPT(5) for ``SURF151`` or ``SURF152`` is first set to 0 and :ref:`esurf` is issued. + Then KEYOPT(5) for ``SURF151`` or ``SURF152`` is set to 2 and :ref:`mstole` is issued. For more + information, see `Using the Surface Effect Elements + `_ in the + `Thermal Analysis Guide + `_. + + For hydrostatic fluid elements ``HSFLD241`` and ``HSFLD242``, the :ref:`esurf` command generates + triangular (2D) or pyramid-shaped (3D) elements with bases that are overlaid on the faces of + selected 2D or 3D solid or shell elements. The single vertex for all generated elements is at the + pressure node specified as ``XNODE``. The generated elements fill the volume enclosed by the solid + or shell elements. The nodes on the overlaid faces have translational degrees of freedom, while the + pressure node shared by all generated elements has a single hydrostatic pressure degree of freedom, + HDSP (see ``HSFLD241`` and ``HSFLD242`` for more information about the pressure node). + """ + command = f"ESURF,{xnode},{tlab},{shape}" + return self.run(command, **kwargs) + + def esym( + self, ninc: str = "", iel1: str = "", iel2: str = "", ieinc: str = "", **kwargs + ): + r"""Generates elements from a pattern by a symmetry reflection. + + Mechanical APDL Command: `ESYM `_ + + Parameters + ---------- + + ninc : str + Increment nodes in the given pattern by ``NINC``. + + iel1 : str + Reflect elements from pattern beginning with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in + steps of ``IEINC`` (defaults to 1). If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + pattern is all selected elements ( :ref:`esel` ). If ``IEL1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are ignored). + + iel2 : str + Reflect elements from pattern beginning with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in + steps of ``IEINC`` (defaults to 1). If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + pattern is all selected elements ( :ref:`esel` ). If ``IEL1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are ignored). + + ieinc : str + Reflect elements from pattern beginning with ``IEL1`` to ``IEL2`` (defaults to ``IEL1`` ) in + steps of ``IEINC`` (defaults to 1). If ``IEL1`` = ALL, ``IEL2`` and ``IEINC`` are ignored and + pattern is all selected elements ( :ref:`esel` ). If ``IEL1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``IEL1`` ( ``IEL2`` and ``IEINC`` are ignored). + + Notes + ----- + + .. _ESYM_notes: + + Generates additional elements from a given pattern (similar to :ref:`egen` ) except with a symmetry + reflection. The operation generates a new element by incrementing the nodes on the original element, + and reversing and shifting the node connectivity pattern. For example, for a 4-node 2D element, the + nodes in positions I, J, K, and L of the original element are placed in positions J, I, L, and K of + the reflected element. + + Similar permutations occur for all other element types. For line elements, the nodes in positions I + and J of the original element are placed in positions J and I of the reflected element. + + It is recommended that symmetry elements be displayed and graphically reviewed. + + If the nodes are also reflected (as with the :ref:`nsym` command), this pattern is such that the + orientation of the symmetry element remains similar to the original element (that is, clockwise + elements are generated from clockwise elements). + + For a non-reflected node pattern, the reversed orientation has the effect of reversing the outward + normal direction (clockwise elements are generated from counterclockwise elements). + + Because nodes may be defined anywhere in the model independently of this command, any orientation of + the symmetry elements is possible. See also the :ref:`ensym` command for modifying existing + elements. + """ + command = f"ESYM,,{ninc},{iel1},{iel2},{ieinc}" + return self.run(command, **kwargs) + + def ewrite( + self, + fname: str = "", + ext: str = "", + kappnd: int | str = "", + format_: str = "", + **kwargs, + ): + r"""Writes elements to a file. + + Mechanical APDL Command: `EWRITE `_ + + Parameters + ---------- + fname : str + File name and directory path (up to 248 characters, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. + + The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). The extension defaults to ELEM if ``Fname`` is + blank. + + kappnd : int or str + Append key: + + * ``0`` - Rewind file before the write operation. + + * ``1`` - Append data to the end of the existing file. + + format_ : str + Format key: + + * ``SHORT`` - I6 format (default). + + * ``LONG`` - I8 format. Switches automatically to I10 if entity IDs are large. + + Notes + ----- + + .. _EWRITE_notes: + + Writes the selected elements to a file. The write operation is unnecessary in a standard Mechanical + APDL + run but is provided as convenience to users wanting a coded element file. + + If issuing :ref:`ewrite` from Mechanical APDL to be used in Mechanical APDL, issue :ref:`nwrite` to + store nodal + information for later use. + + Only elements having all of their nodes defined (and selected) are written. Data are written in a + coded format. The data description of each record is: I, J, K, L, M, N, O, P, MAT, TYPE, REAL, + SECNUM, ESYS, IEL, where MAT, TYPE, REAL, and ESYS are attribute numbers, SECNUM is the beam section + number, and IEL is the element number. + + The format is (14I6) if ``Format`` = SHORT, and (14I8 or 14I10) if ``Format`` = LONG. + + One element description per record is written for elements having <= 8 nodes. For elements having > + 8 nodes, nodes 9 and above are written on a second record using the same format. + """ + command = f"EWRITE,{fname},{ext},,{kappnd},{format_}" + return self.run(command, **kwargs) + + def gcdef( + self, + option: str = "", + sect1: str = "", + sect2: str = "", + matid: str = "", + realid: str = "", + sect1end: str = "", + sect2end: str = "", + **kwargs, + ): + r"""Defines interface interactions between general contact surfaces. + + Mechanical APDL Command: `GCDEF `_ + + Parameters + ---------- + option : str + Option to be performed. + + * ``(blank)`` - Retain the previous ``Option`` setting between ``SECT1`` and ``SECT2``. + + * ``AUTO`` - Define auto asymmetric contact between surfaces ``SECT1`` and ``SECT2``. + + * ``SYMM`` - Define symmetric contact between surfaces ``SECT1`` and ``SECT2``. + + * ``ASYM`` - Define asymmetric contact with ``SECT1`` as the source (contact) surface and ``SECT2`` + as the target surface. + + * ``EXCL`` - Exclude contact between surfaces ``SECT1`` and ``SECT2``. ``MATID``, ``REALID``, + ``SECT1END``, and ``SECT2END`` are ignored. + + * ``DELETE`` - Remove the given definition from the :ref:`gcdef` table. ``MATID``, ``REALID``, + ``SECT1END``, and ``SECT2END`` are ignored. + + Note that :ref:`gcdef`,DELETE,ALL,ALL does not remove the entire :ref:`gcdef` table; it merely + removes any existing :ref:`gcdef`,,ALL,ALL definitions, while leaving intact any existing + :ref:`gcdef` definitions that are more specific. + + To remove the entire :ref:`gcdef` table, issue :ref:`gcdef`,DELETE,TOTAL. + + It is good practice to list all definitions using :ref:`gcdef`,LIST before and after a + :ref:`gcdef`,DELETE command. + + * ``LIST`` - List stored :ref:`gcdef` data entries. ``MATID`` and ``REALID`` are ignored. + + :ref:`gcdef`,LIST lists all defined interactions. :ref:`gcdef`,LIST, ``SECT1``, ``SECT2`` lists the + entry for the specific ``SECT1`` / ``SECT2`` interaction. :ref:`gcdef`,LIST,ALL,ALL lists only the + ALL,ALL entry (if any). + + * ``TABLE`` - List interpreted general contact definitions in tabular format. ``MATID`` and + ``REALID`` are ignored. + + By default, rows/columns of the table that match neighboring rows/columns are compressed to simplify + the table. Issue :ref:`gcdef`,TABLE,TOTAL to list the entire :ref:`gcdef` table without removal of + duplicate rows and columns. + + * ``TABLESOL`` - List a table showing actual interactions considered during solution. This option is + only available after the :ref:`solve` command. ``MATID`` and ``REALID`` are ignored. + + The table shows MAT and REAL entries considered during the solution (actual contact may or may not + have occurred). This is in contrast to :ref:`gcdef`,TABLE, which shows the user specifications. For + auto asymmetric contact, TABLESOL indicates which of the possible contact versus target surface + combinations was considered. + + sect1 : str + Section numbers representing contact ( ``SECT1`` ) and target ( ``SECT2`` ) general contact surfaces + (no defaults). (In most cases, the actual determination of contact versus target surfaces takes + place during :ref:`solve`.) + + A node component name is also valid input for ``SECT1`` and ``SECT2``. The component name is not + stored. Instead, the program loops through all valid section IDs found in the component and creates + :ref:`gcdef` entries for all possible SECT1/SECT2 combinations that result. These entries are + reflected in the ``Option`` = LIST and TABLE output. Section IDs can be further controlled by adding + an extension (_EDGE, _FACE, _VERT, _TOP, or _BOT) to the end of the component name. See in the + `Contact Technology Guide `_ for more information. + + The following labels are also valid input: + + * ``SELF`` - Self contact. + + * ``ALL`` - All general contact sections IDs. + + * ``ALL_EDGE`` - Section IDs of all ``CONTA177`` general contact line elements (which may be on the + edges of 3D solid and shell base elements, or on beam base elements). + + * ``ALL_FACE`` - Section IDs of all general contact elements on faces of solid or shell base + elements (both top and bottom faces of shell elements). + + * ``ALL_VERT`` - Section IDs of all ``CONTA175`` general contact vertex elements (which may be on + convex corners of solid and shell base elements, and on endpoints of beam base elements). + + * ``ALL_TOP`` - Section IDs of all general contact elements on top faces of shell base elements, and + faces of solid base elements. + + * ``ALL_BOT`` - Section IDs of general contact elements on bottom faces of shell base elements, and + faces of solid base elements. + + The ALL labels apply to all defined general contact element section IDs in the model without regard + to the select status of the elements or attached nodes. + + See :ref:`sect12interact` ``SECT1`` / ``SECT2`` Interactions for a description of how the various + inputs for ``SECT1`` and ``SECT2`` are interpreted. + + sect2 : str + Section numbers representing contact ( ``SECT1`` ) and target ( ``SECT2`` ) general contact surfaces + (no defaults). (In most cases, the actual determination of contact versus target surfaces takes + place during :ref:`solve`.) + + A node component name is also valid input for ``SECT1`` and ``SECT2``. The component name is not + stored. Instead, the program loops through all valid section IDs found in the component and creates + :ref:`gcdef` entries for all possible SECT1/SECT2 combinations that result. These entries are + reflected in the ``Option`` = LIST and TABLE output. Section IDs can be further controlled by adding + an extension (_EDGE, _FACE, _VERT, _TOP, or _BOT) to the end of the component name. See in the + `Contact Technology Guide `_ for more information. + + The following labels are also valid input: + + * ``SELF`` - Self contact. + + * ``ALL`` - All general contact sections IDs. + + * ``ALL_EDGE`` - Section IDs of all ``CONTA177`` general contact line elements (which may be on the + edges of 3D solid and shell base elements, or on beam base elements). + + * ``ALL_FACE`` - Section IDs of all general contact elements on faces of solid or shell base + elements (both top and bottom faces of shell elements). + + * ``ALL_VERT`` - Section IDs of all ``CONTA175`` general contact vertex elements (which may be on + convex corners of solid and shell base elements, and on endpoints of beam base elements). + + * ``ALL_TOP`` - Section IDs of all general contact elements on top faces of shell base elements, and + faces of solid base elements. + + * ``ALL_BOT`` - Section IDs of general contact elements on bottom faces of shell base elements, and + faces of solid base elements. + + The ALL labels apply to all defined general contact element section IDs in the model without regard + to the select status of the elements or attached nodes. + + See :ref:`sect12interact` ``SECT1`` / ``SECT2`` Interactions for a description of how the various + inputs for ``SECT1`` and ``SECT2`` are interpreted. + + matid : str + Material ID number for general contact interaction properties at the ``SECT1`` / ``SECT2`` + interface. If zero or blank, the previous setting of ``MATID`` for ``SECT1`` / ``SECT2`` (if + any) is retained. + + As an example, you could specify "always bonded" contact behavior at the interface by setting + ``MATID`` to 2 and issuing the command :ref:`tb`,INTER,2,,,ABOND. + + The coefficient of friction MU is also defined by ``MATID``. Since the default is ``MATID`` = 0, + frictionless contact (MU = 0) is assumed by default. + + realid : str + Real constant ID number for general contact interaction properties at the ``SECT1`` / ``SECT2`` + interface. If zero or blank, the previous setting of ``REALID`` for ``SECT1`` / ``SECT2`` (if + any) is retained. + + As an example, you could specify contact stiffness (FKN) = 10 at the interface by setting + ``REALID`` to 14 and issuing the command :ref:`r`,14,,,10. + + sect1end : str + Last section number in the range. For ``Option`` = LIST, TABLE, or TABLESOL, data entries are + processed for contact section numbers in the range from ``SECT1`` to ``SECT1END``, and target + section numbers in the range from ``SECT2`` to ``SECT2END``. ``SECT1END`` and ``SECT2END`` are + ignored for all other ``Option`` labels. + + sect2end : str + Last section number in the range. For ``Option`` = LIST, TABLE, or TABLESOL, data entries are + processed for contact section numbers in the range from ``SECT1`` to ``SECT1END``, and target + section numbers in the range from ``SECT2`` to ``SECT2END``. ``SECT1END`` and ``SECT2END`` are + ignored for all other ``Option`` labels. + + Notes + ----- + + .. _GCDEF_notes: + + :ref:`gcdef` defines the interface interaction between general contact surfaces identified by + ``SECT1`` and ``SECT2``. :ref:`gcdef` commands are order independent in most cases. + + :ref:`gcdef` definitions should be issued after :ref:`gcgen`. They are saved in the database and are + written to and read from :file:`.CDB` files. + + See `General Contact + `_ + + .. _sect12interact: + + .. rubric:: **SECT1/ SECT2 Interactions** + + The most specific types of general contact definitions are those described below: + + * ``SECT1`` = any valid general surface section ID and ``SECT2`` = any different valid general + surface section ID: ``Option``, ``MATID``, and ``REALID`` apply to general surface interactions + between ``SECT1`` and ``SECT2``. This is one of the most specific types of general contact + definitions and is never overridden. + * ``SECT1`` = any valid general surface section ID and ``SECT2`` = ``SECT1`` : ``Option``, + ``MATID``, and ``REALID`` apply to general surface self contact interactions involving ``SECT1``. + This is one of the most specific types of general contact definitions and is never overridden. + + The remaining general contact definition types can be overridden by the above two general contact + definition types: + + * ``SECT1`` = ALL and ``SECT2`` = ALL: ``Option``, ``MATID``, and ``REALID`` apply to all general + surface interactions, except where overridden by a more specific :ref:`gcdef` command. + * ``SECT1`` = ALL and ``SECT2`` = SELF or ``SECT1`` = SELF and ``SECT2`` = ALL: ``Option``, + ``MATID``, and ``REALID`` apply to all general surface self contact interactions, except where + overridden by a more specific :ref:`gcdef` command. + * ``SECT1`` = ALL and ``SECT2`` = any valid general surface section ID: ``Option``, ``MATID``, and + ``REALID`` apply to all general surface interactions that include ``SECT2``, except where + overridden by a more specific :ref:`gcdef` command. + * ``SECT1`` = any valid general surface section ID and ``SECT2`` = ALL: ``Option``, ``MATID``, and + ``REALID`` apply to all general surface interactions that include ``SECT1``, except where + overridden by a more specific :ref:`gcdef` command. + """ + command = ( + f"GCDEF,{option},{sect1},{sect2},{matid},{realid},{sect1end},{sect2end}" + ) + return self.run(command, **kwargs) + + def gcgen( + self, + option: str = "", + featureangle: str = "", + edgekey: int | str = "", + splitkey: str = "", + selopt: str = "", + **kwargs, + ): + r"""Creates contact elements for general contact. + + Mechanical APDL Command: `GCGEN `_ + + Parameters + ---------- + option : str + Option to be performed. + + * ``NEW`` - Create a new general contact definition. This option removes all existing general + contact elements and generates new elements with new section IDs. Any existing :ref:`gcdef` + specifications, general contact :ref:`sectype` / :ref:`secdata` data, and general contact element + types are also removed. If no general contact elements or data exist, this option behaves the same + as ``Option`` = UPDATE. + + * ``UPDATE`` - Generate general contact elements on newly added (or selected) base elements. Newly + generated contact elements are assigned new Section IDs. Existing general contact elements remain + with their previously assigned section IDs and element attributes. Existing :ref:`gcdef` and + :ref:`sectype` / :ref:`secdata` general contact data are respected. (This is the default option.) + + * ``DELETE`` - Remove all existing general contact elements. Existing :ref:`gcdef` specifications, + general contact :ref:`sectype` / :ref:`secdata` data, and general contact element types are also + removed. + + * ``SELECT`` - Select all existing general contact elements. + + featureangle : str + Angle tolerance for determining feature edges ( ``EdgeKEY`` ) and general surfaces ( + ``SplitKey`` ). Default = 42 degrees. + + edgekey : int or str + Key that controls creation of general contact line and vertex elements ( ``CONTA177``, ``CONTA175`` ) on base elements. Line elements are overlaid on feature edges of 3D deformable bodies and on perimeter edges of 3D shell structures; vertex elements are overlaid on convex corners of deformable bodies and shell structures (2D or 3D), and on endpoints of 3D beam structures. See :ref:`Understanding ` ``FeatureANGLE`` for an explanation of the feature edge criteria. + + * ``0`` - Exclude all edges and vertices (default). + + * ``1`` - Include ``CONTA177`` elements on feature edges only. + + * ``2`` - Include ``CONTA177`` elements on shell perimeter edges only. + + * ``3`` - Include ``CONTA177`` elements on feature edges and shell perimeter edges. + + * ``4`` - Include ``CONTA177`` elements on feature edges and shell perimeter edges, and ``CONTA175`` + elements on vertices. + + * ``5`` - Include ``CONTA175`` elements on vertices only. + + ``EdgeKey`` > 0 is intended to add extra contact constraint between an edge or vertex of one surface + and other 3D surfaces. Both edge and vertex contact always use the penalty method and only include + structural degrees of freedom (UX, UY, UZ). + + :ref:`gcgen` always creates ``CONTA177`` elements on base beam elements, regardless of the + ``EdgeKEY`` setting. + + splitkey : str + Key that controls how section IDs and contact element type IDs are assigned to surfaces. + + * ``SPLIT`` - Assign a different section ID and contact element type ID for every general surface of + the selected base elements (default). See :ref:`Understanding ` ``FeatureANGLE`` for + an explanation of the split criteria. Different section IDs are assigned to the top and bottom + surfaces of 2D shell and 3D shell bodies. This allows different :ref:`gcdef` specifications for + different portions of the assembly. + + * ``PART`` - Assign a different section ID and contact element type ID for every general surface + which covers a physical part. Compared to the SPLIT option, this option produces fewer unique + section IDs, which can make it easier to specify interactions via :ref:`gcdef`. However, it may also + result in a less accurate and/or less efficient solution. + + selopt : str + Key that controls which base elements are considered for general contact. + + * ``ATTACH`` - Use a recursive adjacency selection to obtain complete physical parts (default). This + selection starts from the selected base elements, progressively adding elements adjacent to the + faces of selected elements until the edge of a part is reached. Then general contact elements are + generated. + + * ``SELECT`` - Use only the initially selected base elements to generate general contact elements. + + Notes + ----- + + .. _GCGEN_notes: + + :ref:`gcgen` creates general contact elements on the exterior faces of selected base elements. The + base elements can be 2D or 3D solids, 3D beams, 2D shells (top and bottom), or 3D shells (top and + bottom). The contact element types can be ``CONTA172``, ``CONTA174``, ``CONTA175``, and/or + ``CONTA177``, depending upon the types of base elements in the model and the specified :ref:`gcgen` + options. General contact elements are identified by a real constant ID equal to zero. + + You can control contact interactions between specific general contact surfaces that could + potentially be in contact by using the :ref:`gcdef` command. See `General Contact + `_ + + .. _usingfeatang: + + .. rubric:: **Understanding FeatureANGLE** + + The exterior facets of the selected base solid and shell elements are divided into subsets based on + the angle between the normals of neighboring faces. On a flat or smooth surface, adjacent exterior + element faces have normals that are parallel or nearly parallel; that is, the angle between the + adjacent normals is near zero degrees. + + When the angle between the normals of two adjacent faces is greater than ``FeatureANGLE``, the two + faces are considered to be on two separate surfaces ( ``SplitKey`` = SPLIT). The edge between the + faces may be convex or concave. A convex (or outside) edge is considered to be a feature edge and + may be affected by the ``EdgeKEY`` setting. For more information, see `Feature Angle ( FeatureANGLE) + `_ + """ + command = f"GCGEN,{option},{featureangle},{edgekey},{splitkey},{selopt}" + return self.run(command, **kwargs) + + def laylist( + self, + iel: str = "", + layr1: str = "", + layr2: str = "", + mplab1: str = "", + mplab2: str = "", + **kwargs, + ): + r"""Lists real constants material properties for layered elements. + + Mechanical APDL Command: `LAYLIST `_ + + Parameters + ---------- + iel : str + Element number to be listed. If ALL, list all selected elements ( :ref:`esel` ) of the + appropriate type. If blank and the current element type is a layered element type, list data + from the current real constant table in the layered format. + + layr1 : str + Range of layer numbers to be listed. If ``LAYR1`` is greater than ``LAYR2``, a reverse order + list is produced. ``LAYR1`` defaults to 1. ``LAYR2`` defaults to ``LAYR1`` if ``LAYR1`` is input + or to the number of layers if ``LAYR1`` is not input. + + layr2 : str + Range of layer numbers to be listed. If ``LAYR1`` is greater than ``LAYR2``, a reverse order + list is produced. ``LAYR1`` defaults to 1. ``LAYR2`` defaults to ``LAYR1`` if ``LAYR1`` is input + or to the number of layers if ``LAYR1`` is not input. + + mplab1 : str + Material property labels (for example, EX) to be listed along with the layer real constants. + + mplab2 : str + Material property labels (for example, EX) to be listed along with the layer real constants. + + Notes + ----- + + .. _LAYLIST_notes: + + Lists real constants and any two material properties for layered shell and solid elements. + + If matrix input is selected (KEYOPT(2) = 2 or 3), ``LAYR1``, ``LAYR2``, ``Mplab1``, and ``Mplab2`` + are not used. + + This command is valid in any processor. + """ + command = f"LAYLIST,{iel},{layr1},{layr2},{mplab1},{mplab2}" + return self.run(command, **kwargs) + + def layplot(self, iel: str = "", layr1: str = "", layr2: str = "", **kwargs): + r"""Displays the layer stacking sequence for layered elements. + + Mechanical APDL Command: `LAYPLOT `_ + + Parameters + ---------- + iel : str + Element number for the display. If blank and the current element type is a layered element type, + display data from the current real constant table. + + layr1 : str + Range of layer numbers to be displayed. If ``LAYR1`` is greater than ``LAYR2``, a reversed order + display is produced. Up to 20 layers may be displayed at a time. ``LAYR1`` defaults to 1. + ``LAYR2`` defaults to ``LAYR1`` if ``LAYR1`` is input or to the number of layers (or to 19+ + ``LAYR1``, if smaller) if ``LAYR1`` is not input. + + layr2 : str + Range of layer numbers to be displayed. If ``LAYR1`` is greater than ``LAYR2``, a reversed order + display is produced. Up to 20 layers may be displayed at a time. ``LAYR1`` defaults to 1. + ``LAYR2`` defaults to ``LAYR1`` if ``LAYR1`` is input or to the number of layers (or to 19+ + ``LAYR1``, if smaller) if ``LAYR1`` is not input. + + Notes + ----- + + .. _LAYPLOT_notes: + + Displays the layer-stacking sequence as defined in the real constant table for layered shell and + solid elements in a form where the layers are visible (like a sheared deck of cards). + + The element x-axis is shown as 0.0 degrees. + + Layers are cross-hatched and color-coded for clarity. The hatch lines indicate the layer angle (real + constant THETA) and the color coding is for material identification (real constant MAT). + + The actual orientation of a specific layer in three- dimensional space can be seen using + :ref:`psymb`,LAYR. To use :ref:`psymb`,LAYR with smeared reinforcing elements ( ``REINF265`` ), + first set the vector-mode graphics option ( :ref:`device`,VECTOR,1). + + Layer thickness can be displayed using the :ref:`eshape` and :ref:`eplot` commands. + + This command is valid in any processor. + """ + command = f"LAYPLOT,{iel},{layr1},{layr2}" + return self.run(command, **kwargs) + + def lfsurf(self, sline: str = "", tline: str = "", **kwargs): + r"""Generates surface elements overlaid on the edge of existing solid elements and assigns the extra + node as the closest fluid element node. + + Mechanical APDL Command: `LFSURF `_ + + Parameters + ---------- + sline : str + Component name for the surface lines of the meshed solid areas. The component name must be 32 + characters or less. + + tline : str + Component name for the target lines meshed with fluid elements. The component name must be 32 + characters or less. + + Notes + ----- + + .. _LFSURF_notes: + + This command macro is used to generate surface effect elements overlaid on the surface of existing + plane elements and, based on proximity, to determine and assign the extra node for each surface + element. The underlying areas of the solid region and the fluid lines must be meshed prior to + calling this command macro. The active element type must be ``SURF151`` with appropriate settings + for KEYOPT(4), KEYOPT(5), KEYOPT(6), and KEYOPT(8). + + The surface lines of the solid and the target lines of the fluid are grouped into components and + named using the :ref:`cm` command. The names must be enclosed in single quotes (for example, ' + ``SLINE`` ') when the :ref:`lfsurf` command is manually typed in. + + When using the GUI method, node and element components are created through the picking dialog boxes + associated with this command. + + The macro is applicable for the ``SURF151`` and ``FLUID116`` element types. + """ + command = f"LFSURF,{sline},{tline}" + return self.run(command, **kwargs) + + def ndsurf(self, snode: str = "", telem: str = "", dimn: int | str = "", **kwargs): + r"""Generates surface elements overlaid on the edge of existing elements and assigns the extra node as + the closest fluid element node. + + Mechanical APDL Command: `NDSURF `_ + + Parameters + ---------- + snode : str + Component name for the surface nodes of the solid elements. The component name must be 32 + characters or less. + + telem : str + Component name for the target fluid elements. The component name must be 32 characters or less. + + dimn : int or str + Model dimensionality: + + * ``2`` - 2D model. + + * ``3`` - 3D model. + + Notes + ----- + + .. _NDSURF_notes: + + This command macro is used to generate surface effect elements ( ``SURF151`` or ``SURF152`` ) + overlaid on the surface of existing plane or solid elements and, based on proximity, to determine + and assign the extra node ( ``FLUID116`` ) for each surface element. The active element type must be + ``SURF151`` or ``SURF152`` with appropriate settings for KEYOPT(4), KEYOPT(5), KEYOPT(6), and + KEYOPT(8). + + The surface nodes of the plane or solid elements must be grouped into a node component and the fluid + elements must be grouped into an element component and named using the :ref:`cm` command. The names + must be enclosed in single quotes (for example, 'NOD') when the :ref:`ndsurf` command is manually + typed in. + + When using the GUI method, node and element components are created through the picking dialog boxes + associated with this command. + + The macro is applicable for the ``SURF151``, ``SURF152``, and ``FLUID116`` element types. + """ + command = f"NDSURF,{snode},{telem},{dimn}" + return self.run(command, **kwargs) + + def shsd( + self, + rid: str = "", + action: str = "", + chch_opt: str = "", + cgap: str = "", + cpen: str = "", + **kwargs, + ): + r"""Creates or deletes a shell-solid interface to be used in shell-to-solid assemblies. + + Mechanical APDL Command: `SHSD `_ + + Parameters + ---------- + rid : str + The real constant set ID that identifies the contact pair on which a shell-to-solid assembly is + defined. If ALL, all selected contact pairs will be considered for assembly. + + action : str + Action to be performed: + + * ``EDGE`` - Create virtual shell elements based on the shell edge (default). + + * ``SURFACE`` - Create virtual shell elements based on the solid element surface. + + * ``DELETE`` - Delete the nodes and elements created during a previous execution of :ref:`shsd` for + the real constant set identified by ``RID``. + + chch_opt : str + The description of the argument is missing in the Python function. Please, refer to the `command + documentation + `_ for further + information. + + cgap : str + Control parameter for opening gap; must be greater than or equal to zero. Close the gap if the + gap distance is smaller than the ``CGAP`` value. ``CGAP`` defaults to 0.25\\*PINB (where PINB is + the pinball radius) for bonded and no-separation contact. Otherwise, it defaults to the value of + real constant ICONT. + + cpen : str + Control parameter for initial penetration; must be greater than or equal to zero. Close the + penetration if the penetration distance is smaller than the ``CPEN`` value. ``CPEN`` defaults to + 0.25\\*PINB (where PINB is the pinball radius) for any type of interface behavior (either bonded + or standard contact). + + Notes + ----- + + .. _SHSD_notes: + + The :ref:`shsd` command creates a shell-solid interface to be used in shell-to-solid assemblies, or + deletes a previously-created shell-solid interface. Virtual shell elements and additional + ``CONTA175`` or ``CONTA177`` elements are created at the contact pair identified by ``RID`` when + ``Action`` = EDGE or SURFACE. Set ``Action`` = DELETE to remove the generated nodes and elements at + the contact pair identified by ``RID``. + + The :ref:`shsd` command is active only when the following element KEYOPTs of associated ``CONTA175`` + or ``CONTA177`` element types are predefined: + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + When ``ACTION`` = EDGE, the virtual shell elements are built perpendicular to the pre-existing shell + elements attached to the contact elements. They geometrically follow the contact interface edge and + are built on both sides of this interface in such a way that each new shell element ( ``SHELL181`` ) + has two nodes that belong to the associated pre-existing shell element in the shell edge. (See + :ref:`shsdcontact`.) The width of the new shell elements is half the thickness of the pre-existing + shell element. If ``CONTA175`` is used at the shell nodes, the ``CONTA175`` elements are then + created at each node of the virtual shell elements where no ``CONTA175`` element exists. If + ``CONTA177`` is used at the shell edge, new ``CONTA174`` elements are created and overlayed on the + virtual shell. The new contact elements are identified by the same contact pair ID as the pre- + existing contact elements. The virtual shell elements are assigned the next available element type + number and material number. + + .. figure:: ../../../images/_commands/gSHSDcontact.eps + + Virtual Shell Elements Following the Contact Interface Edge + + When ``ACTION`` = SURFACE, the virtual shell elements ( ``SHELL181`` - low order; ``SHELL281`` - + high order) overlap the existing low or high order target elements identified with the ``RID`` + argument, and share their nodes. Only those target elements close enough to the contact interface + (identified using the PINB real constant) are overlapped. The program uses the FTOLN real constant + (defaults to half the shell element thickness) to define an influence distance. The associated + virtual shell elements are created only for target elements that lie partially inside the influence + distance region (see :ref:`shsdoverlap` ). + + .. figure:: ../../../images/_commands/gSHSDoverlap.eps + + Virtual Shell Elements Overlapping Target Elements + + For the bonded always option (KEYOPT(12) = 5), any contact node inside the pinball region (gap < + PINB) is included in the KEYOPT(5) = 2 process. A relatively small PINB value may be used to prevent + false contact. PINB defaults to 25% of the contact depth for small deformation analyses. + + For the bonded initial option (KEYOPT(12) = 6), only those contact nodes which initially lie inside + the adjustment zone (gap < ICONT) are always included in the KEYOPT(5) = 2 process. ICONT defaults + to 5% of the contact depth. + + For both processes, the new nodes and elements are stored in internally-named components. The + internal naming convention is based on the real constant set ID specified by ``RID``, as illustrated + in the following table. + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + Issuing :ref:`shsd`, ``RID``,DELETE deletes components based on their generated names. Only + components whose names match the internal naming convention will be deleted. + + .. warning:: + + Do not rename or manually delete generated components. Use the SHSD command to delete generated + components. Renaming or manually deleting generated components will cause these components to be + ignored when SHSD, RID,DELETE is executed and when the program searches for these components to + verify if SHSD, RID,EDGE or SURFACE can be safely executed. Manually renaming or deleting + generated components and reissuing SHSD, RID,EDGE or SURFACE may result in erroneous generation + of virtual shell or contact elements. + + :ref:`shsd` does not support assemblies that contain a preintegrated shell section ( + :ref:`sectype`,,GENS). + + See `Modeling a Shell-Solid Assembly + `_ + """ + command = f"SHSD,{rid},{action},{chch_opt},{cgap},{cpen}" + return self.run(command, **kwargs) + + def swadd( + self, + ecomp: str = "", + shrd: str = "", + ncm1: str = "", + ncm2: str = "", + ncm3: str = "", + ncm4: str = "", + ncm5: str = "", + ncm6: str = "", + ncm7: str = "", + ncm8: str = "", + ncm9: str = "", + **kwargs, + ): + r"""Adds more surfaces to an existing spot weld set. + + Mechanical APDL Command: `SWADD `_ + + Parameters + ---------- + ecomp : str + Name of an existing spot weld set that was previously defined using :ref:`swgen`. + + shrd : str + Search radius. Defaults to 4 times the spot weld radius defined for the spot weld set ( ``SWRD`` + on :ref:`swgen` ). + + ncm1 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm2 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm3 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm4 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm5 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm6 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm7 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm8 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + ncm9 : str + Surfaces to be added to the spot weld set. Each surface can be input as a predefined node + component or a meshed area number. + + Notes + ----- + This command adds surfaces to an existing spot weld set defined by the :ref:`swgen` command. You can + add additional surfaces by repeating the :ref:`swadd` command. However, the maximum number of + allowable surfaces (including the 2 surfaces used for the original set defined by :ref:`swgen` ) for + each spot weld set is 11. See `Adding Surfaces to a Basic Set + `_ + for more information. + """ + command = f"SWADD,{ecomp},{shrd},{ncm1},{ncm2},{ncm3},{ncm4},{ncm5},{ncm6},{ncm7},{ncm8},{ncm9}" + return self.run(command, **kwargs) + + def swdel(self, ecomp: str = "", **kwargs): + r"""Deletes spot weld sets. + + Mechanical APDL Command: `SWDEL `_ + + Parameters + ---------- + ecomp : str + Name of an existing spot weld set that was previously defined using :ref:`swgen`. If ``Ecomp`` = + ALL (default) all spot welds are deleted. + + Notes + ----- + This command deletes spot weld sets previously defined by the :ref:`swgen` command. + """ + command = f"SWDEL,{ecomp}" + return self.run(command, **kwargs) + + def swgen( + self, + ecomp: str = "", + swrd: str = "", + ncm1: str = "", + ncm2: str = "", + snd1: str = "", + snd2: str = "", + shrd: str = "", + dirx: str = "", + diry: str = "", + dirz: str = "", + itty: str = "", + icty: str = "", + **kwargs, + ): + r"""Creates a new spot weld set. + + Mechanical APDL Command: `SWGEN `_ + + Parameters + ---------- + ecomp : str + Name to identify the new spot weld, used for the element component containing the new contact, + target, and beam elements generated for the spot weld set. + + swrd : str + Spot weld radius. + + ncm1 : str + Name of a component containing nodes on the first spot weld surface, or a meshed area number for + the surface. + + ncm2 : str + Name of a component containing nodes on the second spot weld surface, or a meshed area number + for the surface. + + snd1 : str + Node number of the first spot weld node corresponding to the first surface ( ``NCM1`` ). This + node can be on or close to the first surface. + + To define multiple spot welds between two surfaces, input the name of a table array parameter + containing the node information for each spot weld. The table name must be enclosed in % signs + (for example, ``tabname``). If ``SND1`` is defined by tabular input, ``SND2`` is ignored. + + snd2 : str + Node number of the second spot weld node corresponding to the second surface ( ``NCM2`` ). This + node can be on or close to the second surface. Mechanical APDL creates the node if not + specified. + + shrd : str + Search radius. Defaults to 4 times the spot weld radius ``SWRD``. + + dirx : str + Spot weld projection direction in terms of normal X, Y, and Z components. + + diry : str + Spot weld projection direction in terms of normal X, Y, and Z components. + + dirz : str + Spot weld projection direction in terms of normal X, Y, and Z components. + + itty : str + Target element type ID. + + icty : str + Contact element type ID. + + Notes + ----- + This command creates a new spot weld set. You can add more surfaces to the set using :ref:`swadd` + after the initial :ref:`swgen` command. However, the maximum number of allowable surfaces (including + the two surfaces used for the original set) for each spot weld set is 11. + + ``Ecomp``, ``SWRD``, ``NCM1``, ``NCM2``, and ``SND1`` must be specified. ``SND2``, ``SHRD``, + ``DIRX``, ``DIRY``, ``DIRZ``, ``ITTY``, ``ICTY`` are optional inputs. If the second spot weld node ( + ``SND2`` ) is specified, that node is used to determine the spot weld projection direction, and + ``DIRX``, ``DIRY`` and ``DIRZ`` are ignored. + + If ``ITTY`` (target element ID) is specified, the following corresponding target element key option + must be set: KEYOPT(2) = 1. + + If ``ICTY`` (contact element ID) is specified, the following corresponding contact element key + options must be set: KEYOPT(2) = 2, KEYOPT(4) = 1, KEYOPT(12) = 5. + + After ``SND1`` and ``SND2`` are projected onto surface 1 and surface 2, respectively, two new pilot + nodes (which represent the spot weld nodes) are generated at the locations of ``SND1`` and ``SND2`` + and meshed with ``TARGE170`` target elements ( :ref:`tshap`,PILO). + + By default, the contact pair created at each spot weld surface is an MPC-based `force-distributed + constraint + `_. + To use force-distributed constraints based on the Lagrange multiplier method, you must set KEYOPT(2) + = 3 for the contact elements after :ref:`swgen` is issued. + + To automatically define multiple spot welds between two surfaces, use tabular input in the ``SND1`` + field. The table array that you input must be a 2D array parameter. For more information, see + `Automatic Generation of Multiple Spot Welds + `_ + + To use the relaxation method to eliminate overconstraint, you must set KEYOPT(11) = 1 for the target + elements after :ref:`swgen` is issued. + + Issue :ref:`swlist` and :ref:`swdel` to list or delete spot welds, respectively. For more + information about defining spot welds, see `Creating a Basic Spot Weld Set with SWGEN + `_ + """ + command = f"SWGEN,{ecomp},{swrd},{ncm1},{ncm2},{snd1},{snd2},{shrd},{dirx},{diry},{dirz},{itty},{icty}" + return self.run(command, **kwargs) + + def swlist(self, ecomp: str = "", **kwargs): + r"""Lists spot weld sets. + + Mechanical APDL Command: `SWLIST `_ + + Parameters + ---------- + ecomp : str + Name of an existing spot weld set that was previously defined using :ref:`swgen`. If ``Ecomp`` = + ALL (default), all spot weld sets are listed. + + Notes + ----- + This command lists spot weld node, beam, and contact pair information for all defined spot weld + sets, or for the specified set. To ensure that all defined spotwelds are listed, issue + :ref:`cmsel`,ALL (to select all components) before issuing the :ref:`swlist` command. + + When :ref:`swlist` is issued in POST1, the beam forces and moments are output. For the case of a + deformable spot weld, the stresses are also output in the beam local coordinate system. + """ + command = f"SWLIST,{ecomp}" + return self.run(command, **kwargs) + + def tshap(self, shape: str = "", **kwargs): + r"""Defines simple 2D and 3D geometric surfaces for target segment elements. + + Mechanical APDL Command: `TSHAP `_ + + Parameters + ---------- + shape : str + Specifies the geometric shapes for target segment elements ``TARGE169`` and ``TARGE170``. + + * ``LINE`` - Straight line (2D, 3D) (Default for 2D) + + * ``PARA`` - Parabola (2D, 3D) + + * ``ARC`` - Clockwise arc (2D) + + * ``CARC`` - Counterclockwise arc (2D) + + * ``CIRC`` - Complete circle (2D) + + * ``TRIA`` - Three-node triangle (3D) (Default for 3D) + + * ``TRI6`` - Six-node triangle (3D) + + * ``QUAD`` - Four-node quadrilateral (3D) + + * ``QUA8`` - Eight-node quadrilateral (3D) + + * ``CYLI`` - Cylinder (3D) + + * ``CONE`` - Cone (3D) + + * ``SPHE`` - Sphere (3D) + + * ``PILO`` - Pilot node (2D, 3D) + + * ``POINT`` - Point (rigid surface node) (2D, 3D) + + Notes + ----- + + .. _TSHAP_notes: + + Use this command to specify the target segment shapes for the rigid target surface associated with + surface-to-surface contact ( ``TARGE169``, ``CONTA172`` (2D) and ``TARGE170``, ``CONTA174`` (3D)), + 3D beam-to-beam contact ( ``TARGE170`` and ``CONTA177`` ), and 3D line-to-surface contact ( + ``TARGE170`` and ``CONTA177`` ). Once you issue :ref:`tshap`, all subsequent target elements + generated via the direct element generation technique will have the same shape, until you issue + :ref:`tshap` again with a different ``Shape`` value. + """ + command = f"TSHAP,{shape}" + return self.run(command, **kwargs) + + def upgeom( + self, + factor: str = "", + lstep: str = "", + sbstep: str = "", + fname: str = "", + ext: str = "", + upesys: str = "", + **kwargs, + ): + r"""Adds displacements from a previous analysis and updates the geometry to the deformed configuration. + + Mechanical APDL Command: `UPGEOM `_ + + Parameters + ---------- + factor : str + Multiplier for displacements being added to coordinates. The value 1.0 adds the full value of + the displacements to the geometry of the finite element model. Defaults to 1.0. + + lstep : str + Load step number of data to be imported. Defaults to the last load step. + + sbstep : str + Substep number of data to be imported. Defaults to the last substep. + + fname : str + File name and directory path (248 characters maximum, including the characters needed for the + directory path). An unspecified directory path defaults to the working directory; in this case, + you can use all 248 characters for the file name. The field must be input (no default). + + ext : str + Filename extension (eight-character maximum). The extension must be :file:`RST`. + + upesys : str + Update behavior for the element coordinate system ( :ref:`esys` ): + + 0 -- Do not update the element coordinate system (default). + + 1 -- Update the element coordinate system to match the material orientation from a previous + analysis. + + Notes + ----- + + .. _UPGEOM_notes: + + This command updates the geometry of the finite element model according to the displacement results + of the previous analysis and creates a revised geometry at the deformed configuration. This command + works on all nodes (default) or on a selected set of nodes. If this command is issued repeatedly, it + creates a revised geometry of the finite element model in a cumulative fashion, that is, it adds + displacement results on the previously generated deformed geometry. The solid model geometry is not + updated by this command. + + When :ref:`upgeom` is issued, the current finite element model is overwritten by finite element + information from the results file. For this reason, it is important that the finite element + information in the results file matches the finite element model in which the nodal coordinates are + being updated. No changes should be made to the model before the :ref:`upgeom` command is issued. + + ``UPESYS`` = 1 is available for homogeneous structural solid elements ( ``SOLID185``, ``SOLID186``, + and ``SOLID187`` ) only and generates only Cartesian coordinate systems. The option is especially + useful when conducting a `loop test + `_ + when orthotropic material is used. For more information, see `Nonlinear Static Analysis with Inverse + Solving + `_ + + .. warning:: + + Orientation nodes for beams and pipes always have zero displacements. Therefore, although this + command may alter the locations of other beam and pipe nodes, it has no effect on orientation + nodes. Carefully inspect the element coordinate systems on the updated model. + """ + command = f"UPGEOM,{factor},{lstep},{sbstep},{fname},{ext},,{upesys}" + return self.run(command, **kwargs) + + def usrdof( + self, + action: str = "", + dof1: str = "", + dof2: str = "", + dof3: str = "", + dof4: str = "", + dof5: str = "", + dof6: str = "", + dof7: str = "", + dof8: str = "", + dof9: str = "", + dof10: str = "", + **kwargs, + ): + r"""Specifies the degrees of freedom for the user-defined element ``USER300``. + + Mechanical APDL Command: `USRDOF `_ + + Parameters + ---------- + action : str + One of the following command operations: + + * ``DEFINE`` - Specify the degrees of freedom (DOFs). This value is the default. + + * ``LIST`` - List all previously specified DOFs. + + * ``DELETE`` - Delete all previously specified DOFs. + + dof1 : str + The list of DOFs. + + dof2 : str + The list of DOFs. + + dof3 : str + The list of DOFs. + + dof4 : str + The list of DOFs. + + dof5 : str + The list of DOFs. + + dof6 : str + The list of DOFs. + + dof7 : str + The list of DOFs. + + dof8 : str + The list of DOFs. + + dof9 : str + The list of DOFs. + + dof10 : str + The list of DOFs. + + Notes + ----- + The :ref:`usrdof` command specifies the degrees of freedom for the user-defined element ``USER300``. + + Although you can intersperse other commands as necessary for your analysis, issue the :ref:`usrdof` + command as part of the following general sequence of commands: + + Issue the :ref:`et` command for element ``USER300``, followed by the related :ref:`type` command. + + Issue both the :ref:`usrelem` and :ref:`usrdof` commands (in either order). + + Define your element using ``USER300``. + + The DOF list ( ``DOF1`` through ``DOF10`` ) can consist of up to 10 DOFs. Use any valid and + appropriate DOF (such as UX, UY, UZ, ROTX, ROTY, ROTZ, AX, AY, AZ, VX, VY, VZ, PRES, WARP, TEMP, + VOLT, MAG, EMF, and CURR). + + You can specify a maximum of 10 DOFs per :ref:`usrdof` command. To define additional DOFs, issue the + command again. + + The maximum number of DOFs for a user-defined element--the number of nodes times the number of DOFs + per node--cannot exceed 480. + + To learn more about user-defined elements, see `Creating a New Element + `_ + """ + command = f"USRDOF,{action},{dof1},{dof2},{dof3},{dof4},{dof5},{dof6},{dof7},{dof8},{dof9},{dof10}" + return self.run(command, **kwargs) + + def usrelem( + self, + nnodes: str = "", + ndim: str = "", + keyshape: str = "", + nreal: str = "", + nsavevars: str = "", + nrsltvar: str = "", + keyansmat: int | str = "", + nintpnts: str = "", + kestress: int | str = "", + keysym: int | str = "", + **kwargs, + ): + r"""Specifies the characteristics of the user-defined element ``USER300``. + + Mechanical APDL Command: `USRELEM `_ + + Parameters + ---------- + nnodes : str + The number of nodes. + + ndim : str + The number of dimensions (of nodal coordinates). Valid values are 2 or 3. + + keyshape : str + One of the following element shape options: + + * ``ANYSHAPE`` - Any shape (that is, no specified shape). This value is the default. + + * ``POINT`` - Point. + + * ``LINE`` - Straight line. + + * ``TRIAN`` - Triangle. + + * ``QUAD`` - Quadrilateral. This shape can be degenerated to a triangle. + + * ``TET`` - Tetrahedron. + + * ``BRICK`` - Brick. This shape can be degenerated to a wedge, pyramid, or tetrahedron. + + nreal : str + The number of real constants. + + nsavevars : str + The number of saved variables. + + nrsltvar : str + The number of variables saved in results files. + + keyansmat : int or str + Key for element formulation control: + + * ``0`` - Create your own material codes within the element formulation. In this case, the real + constants are available to input material properties. You can also input linear material properties + via :ref:`mp` and :ref:`mpdata` commands. + + * ``1`` - Use standard material routines or the UserMat subroutine to form structural material data. + Material properties must be input in the standard way (as you would for non-user-defined elements). + This value is invalid when KeyShape = ANYSHAPE. + + nintpnts : str + The maximum number of integration points (used when ``KEYANSMAT`` = 1). + + kestress : int or str + Key for the element stress state (used when ``KEYANSMAT`` = 1): + + * ``0`` - Plane stress elements. + + * ``1`` - Axisymmetric elements. + + * ``2`` - Plane strain elements. + + * ``3`` - 3D solid elements. + + * ``4`` - 3D solid-shell elements. + + * ``5`` - Generalized plane strain elements. + + * ``6`` - Beam elements. + + * ``7`` - Link/truss elements. + + * ``8`` - 3D shell elements. + + * ``9`` - Axisymmetric shell elements. + + keysym : int or str + Key for specifying whether element stiffness matrices are symmetric or unsymmetric: + + * ``0`` - Symmetric. + + * ``1`` - Unsymmetric. + + Notes + ----- + The :ref:`usrelem` command specifies the characteristics of the user-defined element ``USER300``. + + Although you can intersperse other commands as necessary for your analysis, issue the :ref:`usrelem` + command as part of the following general sequence of commands: + + Issue the :ref:`et` command for element ``USER300``, followed by the related :ref:`type` command. + + Issue both the :ref:`usrelem` and :ref:`usrdof` commands (in either order). + + Define your element using ``USER300``. + + The number of real constants ( ``NREAL`` ) can refer to geometry quantities, material quantities, or + any parameters for element formulation. + + ANSYS saves variables in the :file:`.esav` file to preserve element data when you specify a positive + ``NSAVEVARS`` value. When ``KEYANSMAT`` = 0, all variables of both material and kinematic + formulation are saved. When ``KEYANSMAT`` = 1, only the variables for kinematic formulation (such as + deformation gradient tensor) are saved; in this case, the material routine saves all necessary + material data automatically. + + Element data saved in results files ( ``NRSLTVAR`` ) are accessible only as nonsummable + miscellaneous data. ANSYS saves stress and total strain data for structural elements in the + :file:`.rst` file automatically (as it does for equivalent variables such as thermal gradient and + thermal flux in thermal elements); therefore, ``NRSLTVAR`` does not need to include stress and total + strain data. + + To learn more about creating user-defined elements, see `Creating a New Element + `_ + """ + command = f"USRELEM,{nnodes},{ndim},{keyshape},{nreal},{nsavevars},{nrsltvar},{keyansmat},{nintpnts},{kestress},{keysym}" + return self.run(command, **kwargs) + + def wtbcreate(self, iel: str = "", node: str = "", damp: int | str = "", **kwargs): + r"""Creates a ``USER300`` element to model the turbine for full aeroelastic coupling analysis and + specifies relevant settings for the analysis. + + Mechanical APDL Command: `WTBCREATE `_ + + Parameters + ---------- + iel : str + Element number (next available number by default). + + node : str + Node number connecting support structure and turbine. + + damp : int or str + Damping option for the turbine: + + * ``0`` - Damping matrix obtained from the aeroelastic code plus Rayleigh damping (default). + + * ``1`` - Rayleigh damping only. + + * ``2`` - Damping from the aeroelastic code only. + + Notes + ----- + + .. _WTBCREATE_notes: + + :ref:`wtbcreate` invokes a predefined Mechanical APDL macro that automatically generates a turbine + element + and issue relevant data commands that are necessary to run a full aeroelastic coupling analysis. For + detailed information on how to perform a fully coupled aeroelastic analysis, see `Fully Coupled Wind + Turbine Example in Mechanical APDL + `_ + + The generated ``USER300`` turbine element will have 9 nodes with node numbers NODE, NMAX+1, + NMAX+2,..., NMAX+8, where NMAX is the maximum node number currently in the model. + + There are six freedoms on the first node of the element: UX, UY, UZ, ROTX, ROTY, ROTZ, and these are + true structural freedoms. For all the other nodes (that is, nodes 2 to 9), only the translational + freedoms (UX, UY, UZ) are used. These are generalized freedoms that are internal to the turbine + element and are used by the aeroelastic code only. + + The element type integer of the ``USER300`` element is the current maximum element type integer plus + one. + + The command will also set up the analysis settings appropriate for a full aeroelastic coupling + analysis. These include full Newton-Raphson solution ( :ref:`nropt`,FULL) and a :ref:`usrcal` + command to activate the relevant user routines. + """ + command = f"WTBCREATE,{iel},{node},{damp}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/explicit_dynamics.py b/src/ansys/mapdl/core/_commands/prep7/explicit_dynamics.py similarity index 100% rename from src/ansys/mapdl/core/_commands/preproc/explicit_dynamics.py rename to src/ansys/mapdl/core/_commands/prep7/explicit_dynamics.py diff --git a/src/ansys/mapdl/core/_commands/prep7/hard_points.py b/src/ansys/mapdl/core/_commands/prep7/hard_points.py new file mode 100644 index 00000000000..0061220144a --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/hard_points.py @@ -0,0 +1,134 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class HardPoints: + + def hptcreate( + self, + type_: str = "", + entity: str = "", + nhp: str = "", + label: str = "", + val1: str = "", + val2: str = "", + val3: str = "", + **kwargs, + ): + r"""Defines a hard point. + + Mechanical APDL Command: `HPTCREATE `_ + + Parameters + ---------- + type_ : str + Type of entity on which the hard point will be created. + + * ``LINE`` - Hard point will be created on a line. + + * ``AREA`` - Hard point will be created within an area (not on the boundaries). + + entity : str + Number of the line or area on which the hard point will be created. + + nhp : str + Number assigned to the hard point. Defaults to the lowest available hard point number. + + label : str + If ``LABEL`` = COORD, ``VAL1``, ``VAL2``, and ``VAL3`` are the respective global X, Y, and Z + coordinates. If ``LABEL`` = RATIO, ``VAL`` 1 is the parameter value (this is available only for + lines). Valid parameter values are between 0 and 1. ``VAL2`` and ``VAL3`` are ignored. + + val1 : str + If ``LABEL`` = RATIO, ratio value for line. If ``LABEL`` = COORD, global X coordinate value. + + val2 : str + If ``LABEL`` = COORD, global Y coordinate value. + + val3 : str + If ``LABEL`` = COORD, global Z coordinate value. + + Notes + ----- + + .. _HPTCREATE_notes: + + The ability to enter a parameter value provides a simple way of positioning hard points on lines. + For example, to place a hard point halfway along a line, one can simply specify a ``VAL1`` value of + 0.5. + + For models imported through the DEFAULT IGES filter, you can place hard points on models only by + specifying coordinates (you can't place a hard point using interactive picking). + + If you issue any commands that update the geometry of an entity, such as Boolean or simplification + commands, any hard points associated with that entity are deleted. Therefore, you should add any + hard points after completing the solid model. If you delete an entity that has associated hard + points, those hard points are either + + * Deleted along with the entity (if the hard point is not associated with any other entities). + + * Detached from the deleted entity (if the hard point is associated with additional entities). + + When archiving your model ( :ref:`cdwrite` ), hardpoint information cannot be written to the IGES + file. The :file:`Jobname.cdb` file can be written with the :ref:`cdwrite`,DB option. + + Hard points are only applicable for area and volume meshing, not for beams. + """ + command = f"HPTCREATE,{type_},{entity},{nhp},{label},{val1},{val2},{val3}" + return self.run(command, **kwargs) + + def hptdelete(self, np1: str = "", np2: str = "", ninc: str = "", **kwargs): + r"""Deletes selected hardpoints. + + Mechanical APDL Command: `HPTDELETE `_ + + Parameters + ---------- + np1 : str + Delete the pattern of hard points beginning with ``NP1`` to ``NP2`` in steps of ``NINC`` + (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and the pattern is all + selected hard points ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled and all + remaining command fields are ignored. + + np2 : str + Delete the pattern of hard points beginning with ``NP1`` to ``NP2`` in steps of ``NINC`` + (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and the pattern is all + selected hard points ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled and all + remaining command fields are ignored. + + ninc : str + Delete the pattern of hard points beginning with ``NP1`` to ``NP2`` in steps of ``NINC`` + (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and the pattern is all + selected hard points ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled and all + remaining command fields are ignored. + + Notes + ----- + + .. _HPTDELETE_notes: + + Deletes all attributes attached to the designated hard points as well as the hard points themselves. + If any entity is attached to a designated hard point, the command detaches the hard point from that + entity (the program will alert you that this will occur). + """ + command = f"HPTDELETE,{np1},{np2},{ninc}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/prep7/keypoints.py b/src/ansys/mapdl/core/_commands/prep7/keypoints.py new file mode 100644 index 00000000000..8a06afdab88 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/keypoints.py @@ -0,0 +1,1180 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from ansys.mapdl.core._commands import parse + + +class Keypoints: + + def gsum(self, **kwargs): + r"""Calculates and prints geometry items. + + Mechanical APDL Command: `GSUM `_ + + Notes + ----- + + .. _GSUM_notes: + + Calculates and prints geometry items (centroid location, moments of inertia, length, area, volume + etc.) associated with the selected keypoints, lines, areas, and volumes. Geometry items are reported + in the global Cartesian coordinate system. For volumes, a unit density is assumed unless the volumes + have a material association via the :ref:`vatt` command. For areas, a unit density (and thickness) + is assumed unless the areas have a material (and real constant) association via the :ref:`aatt` + command. For lines and keypoints, a unit density is assumed, irrespective of any material + associations ( :ref:`latt`, :ref:`katt`, :ref:`mat` ). Items calculated by :ref:`gsum` and later + retrieved by a :ref:`get` or :ref:`starvget` commands are valid only if the model is not + modified after the :ref:`gsum` command is issued. This command combines the functions of the + :ref:`ksum`, :ref:`lsum`, :ref:`asum`, and :ref:`vsum` commands. + """ + command = "GSUM" + return self.run(command, **kwargs) + + def k(self, npt: str = "", x: str = "", y: str = "", z: str = "", **kwargs): + r"""Defines a keypoint. + + Mechanical APDL Command: `K `_ + + Parameters + ---------- + npt : str + Reference number for keypoint. If zero, the lowest available number is assigned ( :ref:`numstr` + ). + + x : str + Keypoint location in the active coordinate system (may be R, θ, Z or R, θ, Φ). If ``X`` = P, + graphical picking is enabled and all other fields (including ``NPT`` ) are ignored (valid only + in the GUI). + + y : str + Keypoint location in the active coordinate system (may be R, θ, Z or R, θ, Φ). If ``X`` = P, + graphical picking is enabled and all other fields (including ``NPT`` ) are ignored (valid only + in the GUI). + + z : str + Keypoint location in the active coordinate system (may be R, θ, Z or R, θ, Φ). If ``X`` = P, + graphical picking is enabled and all other fields (including ``NPT`` ) are ignored (valid only + in the GUI). + + Returns + ------- + int + The keypoint number of the generated keypoint. + + Notes + ----- + + .. _K_notes: + + Defines a keypoint in the active coordinate system ( :ref:`csys` ) for line, area, and volume + descriptions. A previously defined keypoint of the same number will be redefined. Keypoints may be + redefined only if it is not yet attached to a line or is not yet meshed. Solid modeling in a + toroidal system is not recommended. + + Examples + -------- + Create keypoint at ``(0, 1, 2)`` + + >>> knum = mapdl.k('', 0, 1, 2) + >>> knum + 1 + + Create keypoint at ``(10, 11, 12)`` while specifying the + keypoint number. + + >>> knum = mapdl.k(5, 10, 11, 12) + >>> knum + 5 + """ + command = f"K,{npt},{x},{y},{z}" + return parse.parse_k(self.run(command, **kwargs)) + + def kbetw( + self, + kp1: str = "", + kp2: str = "", + kpnew: str = "", + type_: str = "", + value: str = "", + **kwargs, + ): + r"""Creates a keypoint between two existing keypoints. + + Mechanical APDL Command: `KBETW `_ + + Parameters + ---------- + kp1 : str + First keypoint. If ``KP1`` = P, graphical picking is enabled and all remaining command fields + are ignored (valid only in the GUI). + + kp2 : str + Second keypoint. + + kpnew : str + Number assigned to the new keypoint. Defaults to the lowest available keypoint number. + + type_ : str + Type of input for ``VALUE``. + + * ``RATIO`` - Value is the ratio of the distances between keypoints as follows: ( ``KP1`` - + ``KPNEW`` )/( ``KP1`` - ``KP2`` ). + + * ``DIST`` - Value is the absolute distance between ``KP1`` and ``KPNEW`` (valid only if current + coordinate system is Cartesian). + + value : str + Location of new keypoint, as defined by ``Type`` (defaults to 0.5). If ``VALUE`` is a ratio ( + ``Type`` = RATIO) and is less than 0 or greater than 1, the keypoint is created on the extended + line. Similarly, if ``VALUE`` is a distance ( ``Type`` = DIST) and is less than 0 or greater + than the distance between ``KP1`` and ``KP2``, the keypoint is created on the extended line. + + Returns + ------- + int + Keypoint number of the generated keypoint. + + Notes + ----- + + .. _KBETW_notes: + + Placement of the new keypoint depends on the currently active coordinate system ( :ref:`csys` ). If + the coordinate system is Cartesian, the keypoint will lie on a straight line between ``KP1`` and + ``KP2``. If the system is not Cartesian (for example, cylindrical, spherical, etc.), the keypoint + will be located as if on a line (which may not be straight) created in the current coordinate system + between ``KP1`` and ``KP2``. Note that solid modeling in a toroidal coordinate system is not + recommended. + + Examples + -------- + Create a keypoint exactly centered between two keypoints. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 0, 0) + >>> k2 = mapdl.kbetw(k0, k1) + >>> k2 + 3 + """ + command = f"KBETW,{kp1},{kp2},{kpnew},{type_},{value}" + return parse.parse_kpoint(self.run(command, **kwargs)) + + def kcenter( + self, + type_: str = "", + val1: str = "", + val2: str = "", + val3: str = "", + val4: str = "", + kpnew: str = "", + **kwargs, + ): + r"""Creates a keypoint at the center of a circular arc defined by three locations. + + Mechanical APDL Command: `KCENTER `_ + + Parameters + ---------- + type_ : str + Type of entity used to define the circular arc. The meaning of ``VAL1`` through ``VAL4`` will vary depending on ``Type``. If ``Type`` = P, graphical picking is enabled and all remaining command fields are ignored (valid only in the GUI). + + * ``KP`` - Arc is defined by keypoints. + + * ``LINE`` - Arc is defined by locations on a line. + + val1 : str + Values used to specify three locations on the arc (see table below). + + val2 : str + Values used to specify three locations on the arc (see table below). + + val3 : str + Values used to specify three locations on the arc (see table below). + + val4 : str + Values used to specify three locations on the arc (see table below). + + kpnew : str + Number assigned to new keypoint. Defaults to the lowest available keypoint number. + + Returns + ------- + int + Keypoint number of the generated keypoint. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + .. _KCENTER_notes: + + :ref:`kcenter` should be used in the Cartesian coordinate system ( :ref:`csys`,0) only. This command + provides three methods to define a keypoint at the center of three locations. As shown below, the + center point can be calculated based on a) three keypoints, b) three keypoints and a radius, or c) + three locations on a line. Note that for method c, if a circular line is specified by ``VAL1``, + ``VAL2`` through ``VAL4`` are not needed. + + .. only:: html + + .. figure:: ../../../images/_commands/gKCEN1.svg + + + Examples + -------- + Create a keypoint at the center of a circle centered at (0, 0, 0) + + >>> k0 = mapdl.k("", 0, 1, 0) + >>> k1 = mapdl.k("", 1, 0, 0) + >>> k2 = mapdl.k("", 0, -1, 0) + >>> k3 = mapdl.kcenter('KP', k0, k1, k2) + >>> k3 + 4 + """ + command = f"KCENTER,{type_},{val1},{val2},{val3},{val4},{kpnew}" + return parse.parse_kpoint(self.run(command, **kwargs)) + + def kdele(self, np1: str = "", np2: str = "", ninc: str = "", **kwargs): + r"""Deletes unmeshed keypoints. + + Mechanical APDL Command: `KDELE `_ + + Parameters + ---------- + np1 : str + Delete keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults + to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are deleted. If ``NP1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + Delete keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults + to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are deleted. If ``NP1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + Delete keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults + to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are deleted. If ``NP1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + Notes + ----- + + .. _KDELE_notes: + + Deletes selected keypoints. A keypoint attached to a line cannot be deleted unless the line is first + deleted. + """ + command = f"KDELE,{np1},{np2},{ninc}" + return self.run(command, **kwargs) + + def kdist(self, kp1: str = "", kp2: str = "", **kwargs): + r"""Calculates and lists the distance between two keypoints. + + Mechanical APDL Command: `KDIST `_ + + Parameters + ---------- + kp1 : str + First keypoint in distance calculation. If ``KP1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). + + kp2 : str + Second keypoint in distance calculation. + + Returns + ------- + list + ``[DIST, X, Y, Z]`` distance between two keypoints. + + Notes + ----- + + .. _KDIST_notes: + + :ref:`kdist` lists the distance between keypoints ``KP1`` and ``KP2``, as well as the current + coordinate system offsets from ``KP1`` to ``KP2``, where the X, Y, and Z locations of ``KP1`` are + subtracted from the X, Y, and Z locations of ``KP2`` (respectively) to determine the offsets. + :ref:`kdist` is valid in any coordinate system except toroidal ( :ref:`csys`,3). + + :ref:`kdist` returns a variable, called ``_RETURN``, which contains the distance value. You can use + this value for various purposes; for example, to set the default number of line divisions to be + generated along region boundary lines ( :ref:`esize`, ``_RETURN`` ). In interactive mode, you can + access this command by using the Model Query Picker ( Utility Menu> List> Picked Entities ), where + you can also access automatic annotation functions, and display the value on your model. + + This command is valid in any processor. + + Examples + -------- + Compute the distance between two keypoints. + + >>> kp0 = (0, 10, -3) + >>> kp1 = (1, 5, 10) + >>> knum0 = mapdl.k("", *kp0) + >>> knum1 = mapdl.k("", *kp1) + >>> dist = mapdl.kdist(knum0, knum1) + >>> dist + [13.96424004376894, 1.0, -5.0, 13.0] + """ + return parse.parse_kdist(self.run(f"KDIST,{kp1},{kp2}", **kwargs)) + + def kfill( + self, + np1: str = "", + np2: str = "", + nfill: str = "", + nstrt: str = "", + ninc: str = "", + space: str = "", + **kwargs, + ): + r"""Generates keypoints between two keypoints. + + Mechanical APDL Command: `KFILL `_ + + Parameters + ---------- + np1 : str + Beginning and ending keypoints for fill-in. ``NP1`` defaults to next to last keypoint specified, + ``NP2`` defaults to last keypoint specified. If ``NP1`` = P, graphical picking is enabled and + all remaining command fields are ignored (valid only in the GUI). + + np2 : str + Beginning and ending keypoints for fill-in. ``NP1`` defaults to next to last keypoint specified, + ``NP2`` defaults to last keypoint specified. If ``NP1`` = P, graphical picking is enabled and + all remaining command fields are ignored (valid only in the GUI). + + nfill : str + Fill ``NFILL`` keypoints between ``NP1`` and ``NP2`` (defaults to \| ``NP2`` - ``NP1`` \|-1). + ``NFILL`` must be positive. + + nstrt : str + Keypoint number assigned to first filled-in keypoint (defaults to ``NP1`` + ``NINC`` ). + + ninc : str + Add this increment to each of the remaining filled-in keypoint numbers (may be positive or + negative). Defaults to ( ``NP2`` - ``NP1`` )/( ``NFILL`` + 1), that is, linear interpolation. + + space : str + Spacing ratio. Ratio of last division size to first division size. If > 1.0, divisions increase. + If < 1.0, divisions decrease. Ratio defaults to 1.0 (uniform spacing). + + Notes + ----- + + .. _KFILL_notes: + + Generates keypoints (in the active coordinate system) between two existing keypoints. The two + keypoints may have been defined in any coordinate system. However, solid modeling in a toroidal + coordinate system is not recommended. Any number of keypoints may be filled in and any keypoint + numbering sequence may be assigned. + """ + command = f"KFILL,{np1},{np2},{nfill},{nstrt},{ninc},{space}" + return self.run(command, **kwargs) + + def kgen( + self, + itime: str = "", + np1: str = "", + np2: str = "", + ninc: str = "", + dx: str = "", + dy: str = "", + dz: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Generates additional keypoints from a pattern of keypoints. + + Mechanical APDL Command: `KGEN `_ + + Parameters + ---------- + itime : str + Do this generation operation a total of ``ITIME`` times, incrementing all keypoints in the given + pattern automatically (or by ``KINC`` ) each time after the first. ``ITIME`` must be more than 1 + for generation to occur. + + np1 : str + Generate keypoints from the pattern of keypoints beginning with ``NP1`` to ``NP2`` (defaults to + ``NP1`` ) in steps of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are + ignored and the pattern is all selected keypoints ( :ref:`ksel` ). If ``NP1`` is negative, + ``NP2`` and ``NINC`` are ignored and the last \| ``NP1`` \| keypoints (in sequence from the + highest keypoint number) are used as the pattern to be repeated. If ``NP1`` = P, graphical + picking is enabled and all remaining command fields are ignored (valid only in the GUI). A + component name may also be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + Generate keypoints from the pattern of keypoints beginning with ``NP1`` to ``NP2`` (defaults to + ``NP1`` ) in steps of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are + ignored and the pattern is all selected keypoints ( :ref:`ksel` ). If ``NP1`` is negative, + ``NP2`` and ``NINC`` are ignored and the last \| ``NP1`` \| keypoints (in sequence from the + highest keypoint number) are used as the pattern to be repeated. If ``NP1`` = P, graphical + picking is enabled and all remaining command fields are ignored (valid only in the GUI). A + component name may also be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + Generate keypoints from the pattern of keypoints beginning with ``NP1`` to ``NP2`` (defaults to + ``NP1`` ) in steps of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are + ignored and the pattern is all selected keypoints ( :ref:`ksel` ). If ``NP1`` is negative, + ``NP2`` and ``NINC`` are ignored and the last \| ``NP1`` \| keypoints (in sequence from the + highest keypoint number) are used as the pattern to be repeated. If ``NP1`` = P, graphical + picking is enabled and all remaining command fields are ignored (valid only in the GUI). A + component name may also be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + dx : str + Keypoint location increments in the active coordinate system (DR, Dθ, DZ for cylindrical, DR, + Dθ, DΦ for spherical). + + dy : str + Keypoint location increments in the active coordinate system (DR, Dθ, DZ for cylindrical, DR, + Dθ, DΦ for spherical). + + dz : str + Keypoint location increments in the active coordinate system (DR, Dθ, DZ for cylindrical, DR, + Dθ, DΦ for spherical). + + kinc : str + Keypoint increment between generated sets. If zero, the lowest available keypoint numbers are + assigned ( :ref:`numstr` ). + + noelem : int or str + Specifies if elements and nodes are also to be generated: + + * ``0`` - Generate nodes and point elements associated with the original keypoints, if they exist. + + * ``1`` - Do not generate nodes and elements. + + imove : int or str + Specifies whether keypoints will be moved or newly defined: + + * ``0`` - Generate additional keypoints as requested with the ``ITIME`` argument. + + * ``1`` - Move original keypoints to new position retaining the same keypoint numbers ( ``ITIME``, + ``KINC``, and ``NOELEM`` are ignored). Valid only if the old keypoints are no longer needed at their + original positions. Corresponding meshed items are also moved if not needed at their original + position. + + Notes + ----- + + .. _KGEN_notes: + + Generates additional keypoints (and corresponding mesh) from a given keypoint pattern. The MAT, + TYPE, REAL, and ESYS attributes are based upon the keypoints in the pattern and not upon the current + settings. Generation is done in the active coordinate system. Keypoints in the pattern may have been + defined in any coordinate system. However, solid modeling in a toroidal coordinate system is not + recommended. + """ + command = ( + f"KGEN,{itime},{np1},{np2},{ninc},{dx},{dy},{dz},{kinc},{noelem},{imove}" + ) + return self.run(command, **kwargs) + + def kl(self, nl1: str = "", ratio: str = "", nk1: str = "", **kwargs): + r"""Generates a keypoint at a specified location on an existing line. + + Mechanical APDL Command: `KL `_ + + Parameters + ---------- + nl1 : str + Number of the line. If negative, the direction of line (as interpreted for ``RATIO`` ) is + reversed. If ``NL1`` = P, graphical picking is enabled and all remaining command fields are + ignored (valid only in the GUI). + + ratio : str + Ratio of line length to locate keypoint. Must be between 0.0 and 1.0. Defaults to 0.5 (divide + the line in half). + + nk1 : str + Number to be assigned to keypoint generated at division location (defaults to lowest available + keypoint number ( :ref:`numstr` )). + + Returns + ------- + int + Keypoint number of the generated keypoint. + + Examples + -------- + Create a keypoint on a line from (0, 0, 0) and (10, 0, 0) + + >>> kp0 = (0, 0, 0) + >>> kp1 = (10, 0, 0) + >>> knum0 = mapdl.k("", *kp0) + >>> knum1 = mapdl.k("", *kp1) + >>> lnum = mapdl.l(knum0, knum1) + >>> lnum + 1 + """ + cmd = f"KL,{nl1},{ratio},{nk1}" + return parse.parse_kl(self.run(cmd, **kwargs)) + + def klist( + self, np1: str = "", np2: str = "", ninc: str = "", lab: str = "", **kwargs + ): + r"""Lists the defined keypoints or hard points. + + Mechanical APDL Command: `KLIST `_ + + Parameters + ---------- + np1 : str + List keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults to + 1). If ``NP1`` = ALL (default), ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are listed. If ``NP1`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for ``NP1`` + ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + List keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults to + 1). If ``NP1`` = ALL (default), ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are listed. If ``NP1`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for ``NP1`` + ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + List keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults to + 1). If ``NP1`` = ALL (default), ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are listed. If ``NP1`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for ``NP1`` + ( ``NP2`` and ``NINC`` are ignored). + + lab : str + Coordinate listing key: + + * ``(blank)`` - List all keypoint information. + + * ``COORD`` - Suppress all but the keypoint coordinates (shown to a higher degree of accuracy than + when displayed with all information). + + * ``HPT`` - List only hard point information. + + Notes + ----- + + .. _KLIST_notes: + + Lists keypoints in the active display coordinate system ( :ref:`dsys` ). An attribute (TYPE, MAT, + REAL, or ESYS) listed as a zero is unassigned; one listed as a positive value indicates that the + attribute was assigned with the :ref:`katt` command (and will not be reset to zero if the mesh is + cleared); one listed as a negative value indicates that the attribute was assigned using the + attribute pointer ( :ref:`type`, :ref:`mat`, :ref:`real`, or :ref:`esys` ) that was active during + meshing (and will be reset to zero if the mesh is cleared). + + This command is valid in any processor. + """ + command = f"KLIST,{np1},{np2},{ninc},{lab}" + return self.run(command, **kwargs) + + def kmodif(self, npt: str = "", x: str = "", y: str = "", z: str = "", **kwargs): + r"""Modifies an existing keypoint. + + Mechanical APDL Command: `KMODIF `_ + + Parameters + ---------- + npt : str + Modify coordinates of this keypoint. If ``NPT`` = ALL, modify coordinates of all selected + keypoints ( :ref:`ksel` ). If ``NPT`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NPT``. + + x : str + Replace the previous coordinate values assigned to this keypoint with these corresponding + coordinate values. Values are interpreted according to the active coordinate system (R, θ, Z for + cylindrical, R, θ,Φ for spherical). If ``X`` = P, graphical picking is used to locate keypoint + and ``Y`` and ``Z`` are ignored. A blank retains the previous value. You cannot specify ``Y`` = + P. + + y : str + Replace the previous coordinate values assigned to this keypoint with these corresponding + coordinate values. Values are interpreted according to the active coordinate system (R, θ, Z for + cylindrical, R, θ,Φ for spherical). If ``X`` = P, graphical picking is used to locate keypoint + and ``Y`` and ``Z`` are ignored. A blank retains the previous value. You cannot specify ``Y`` = + P. + + z : str + Replace the previous coordinate values assigned to this keypoint with these corresponding + coordinate values. Values are interpreted according to the active coordinate system (R, θ, Z for + cylindrical, R, θ,Φ for spherical). If ``X`` = P, graphical picking is used to locate keypoint + and ``Y`` and ``Z`` are ignored. A blank retains the previous value. You cannot specify ``Y`` = + P. + + Notes + ----- + + .. _KMODIF_notes: + + Lines, areas, and volumes attached to the modified keypoint (if any) must all be selected and will + be redefined using the active coordinate system. However, solid modeling in a toroidal coordinate + system is not recommended. + + .. warning:: + + Redefined entities may be removed from any defined components and assemblies. Nodes and elements + will be automatically cleared from any redefined keypoints, lines, areas, or volumes. + + The :ref:`kmodif` command moves keypoints for geometry modification without validating underlying + entities. To merge keypoints and update higher order entities, issue the :ref:`nummrg` command + instead. + """ + command = f"KMODIF,{npt},{x},{y},{z}" + return self.run(command, **kwargs) + + def kmove( + self, + npt: str = "", + kc1: str = "", + x1: str = "", + y1: str = "", + z1: str = "", + kc2: str = "", + x2: str = "", + y2: str = "", + z2: str = "", + **kwargs, + ): + r"""Calculates and moves a keypoint to an intersection. + + Mechanical APDL Command: `KMOVE `_ + + Parameters + ---------- + npt : str + Move this keypoint. If ``NPT`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NPT``. + + kc1 : str + First coordinate system number. Defaults to 0 (global Cartesian). + + x1 : str + Input one or two values defining the location of the keypoint in this coordinate system. Input + "U" for unknown value(s) to be calculated and input "E" to use an existing coordinate value. + Fields are R1, θ1, Z1 for cylindrical, or R1, θ1, ϕ1 for spherical. + + y1 : str + Input one or two values defining the location of the keypoint in this coordinate system. Input + "U" for unknown value(s) to be calculated and input "E" to use an existing coordinate value. + Fields are R1, θ1, Z1 for cylindrical, or R1, θ1, ϕ1 for spherical. + + z1 : str + Input one or two values defining the location of the keypoint in this coordinate system. Input + "U" for unknown value(s) to be calculated and input "E" to use an existing coordinate value. + Fields are R1, θ1, Z1 for cylindrical, or R1, θ1, ϕ1 for spherical. + + kc2 : str + Second coordinate system number. + + x2 : str + Input two or one value(s) defining the location of the keypoint in this coordinate system. Input + U for unknown value(s) to be calculated and input E to use an existing coordinate value. + Arguments are R2, θ2, Z2 for cylindrical, or R2, θ2, ϕ2 for spherical. + + y2 : str + Input two or one value(s) defining the location of the keypoint in this coordinate system. Input + U for unknown value(s) to be calculated and input E to use an existing coordinate value. + Arguments are R2, θ2, Z2 for cylindrical, or R2, θ2, ϕ2 for spherical. + + z2 : str + Input two or one value(s) defining the location of the keypoint in this coordinate system. Input + U for unknown value(s) to be calculated and input E to use an existing coordinate value. + Arguments are R2, θ2, Z2 for cylindrical, or R2, θ2, ϕ2 for spherical. + + Notes + ----- + + .. _KMOVE_notes: + + Calculates and moves a keypoint to an intersection location. The keypoint must have been previously + defined (at an approximate location) or left undefined (in which case it is internally defined at + the :ref:`source` location). The actual location is calculated from the intersection of three + surfaces (implied from three coordinate constants in two different coordinate systems). Note that + solid modeling in a toroidal coordinate system is not recommended. See the :ref:`move` command for + surface and intersection details. The three (of six) constants easiest to define should be used. The + program will calculate the remaining three coordinate constants. All arguments, except ``KC1``, must + be input. Use the repeat command ( ``*REPEAT`` ) after the :ref:`kmove` command to move a series of + keypoints, if desired. + """ + command = f"KMOVE,{npt},{kc1},{x1},{y1},{z1},{kc2},{x2},{y2},{z2}" + return self.run(command, **kwargs) + + def knode(self, npt: str = "", node: str = "", **kwargs): + r"""Defines a keypoint at an existing node location. + + Mechanical APDL Command: `KNODE `_ + + Parameters + ---------- + npt : str + Arbitrary reference number for keypoint. If zero, the lowest available number is assigned ( + :ref:`numstr` ). + + node : str + Node number defining global X, Y, Z keypoint location. If ``NODE`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). A component name + may also be substituted for ``NODE``. + + Returns + ------- + int + Keypoint number of the generated keypoint. + + Examples + -------- + Create a keypoint at a node at (1, 2, 3) + + >>> nnum = mapdl.n('', 1, 2, 3) + >>> knum1 = mapdl.knode('', nnum) + >>> knum1 + 1 + """ + cmd = f"KNODE,{npt},{node}" + return parse.parse_knode(self.run(cmd, **kwargs)) + + def kplot( + self, np1: str = "", np2: str = "", ninc: str = "", lab: str = "", **kwargs + ): + r"""Displays the selected keypoints. + + Mechanical APDL Command: `KPLOT `_ + + Parameters + ---------- + np1 : str + Display keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults + to 1). If ``NP1`` = ALL (default), ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are displayed. + + np2 : str + Display keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults + to 1). If ``NP1`` = ALL (default), ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are displayed. + + ninc : str + Display keypoints from ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps of ``NINC`` (defaults + to 1). If ``NP1`` = ALL (default), ``NP2`` and ``NINC`` are ignored and all selected keypoints ( + :ref:`ksel` ) are displayed. + + lab : str + Determines what keypoints are plotted (one of the following): + + * ``(blank)`` - Plots all keypoints. + + * ``HPT`` - Plots only those keypoints that are hard points. + + Notes + ----- + + .. _KPLOT_notes: + + This command is valid in any processor. + """ + command = f"KPLOT,{np1},{np2},{ninc},{lab}" + return self.run(command, **kwargs) + + def kpscale( + self, + np1: str = "", + np2: str = "", + ninc: str = "", + rx: str = "", + ry: str = "", + rz: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Generates a scaled set of (meshed) keypoints from a pattern of keypoints. + + Mechanical APDL Command: `KPSCALE `_ + + Parameters + ---------- + np1 : str + Set of keypoints ( ``NP1`` to ``NP2`` in steps of ``NINC`` ) that defines the pattern to be + scaled. ``NP2`` defaults to ``NP1``, ``NINC`` defaults to 1. If ``NP1`` = ALL, ``NP2`` and + ``NINC`` are ignored and the pattern is defined by all selected keypoints. If ``NP1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). A component name may also be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + Set of keypoints ( ``NP1`` to ``NP2`` in steps of ``NINC`` ) that defines the pattern to be + scaled. ``NP2`` defaults to ``NP1``, ``NINC`` defaults to 1. If ``NP1`` = ALL, ``NP2`` and + ``NINC`` are ignored and the pattern is defined by all selected keypoints. If ``NP1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). A component name may also be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + Set of keypoints ( ``NP1`` to ``NP2`` in steps of ``NINC`` ) that defines the pattern to be + scaled. ``NP2`` defaults to ``NP1``, ``NINC`` defaults to 1. If ``NP1`` = ALL, ``NP2`` and + ``NINC`` are ignored and the pattern is defined by all selected keypoints. If ``NP1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). A component name may also be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + rx : str + Scale factors to be applied to the X, Y, Z keypoint coordinates in the active coordinate system + (RR, Rθ, RZ for cylindrical; RR, Rθ, RΦ for spherical). The Rθ and RΦ scale factors are + interpreted as angular offsets. For example, if CSYS = 1, an ``RX``, ``RY``, ``RZ`` input of + (1.5,10,3) would scale the specified keypoints 1.5 times in the radial and 3 times in the Z + direction, while adding an offset of 10 degrees to the keypoints.) Zero, blank, or negative + scale factor values are assumed to be 1.0. Zero or blank angular offsets have no effect. + + ry : str + Scale factors to be applied to the X, Y, Z keypoint coordinates in the active coordinate system + (RR, Rθ, RZ for cylindrical; RR, Rθ, RΦ for spherical). The Rθ and RΦ scale factors are + interpreted as angular offsets. For example, if CSYS = 1, an ``RX``, ``RY``, ``RZ`` input of + (1.5,10,3) would scale the specified keypoints 1.5 times in the radial and 3 times in the Z + direction, while adding an offset of 10 degrees to the keypoints.) Zero, blank, or negative + scale factor values are assumed to be 1.0. Zero or blank angular offsets have no effect. + + rz : str + Scale factors to be applied to the X, Y, Z keypoint coordinates in the active coordinate system + (RR, Rθ, RZ for cylindrical; RR, Rθ, RΦ for spherical). The Rθ and RΦ scale factors are + interpreted as angular offsets. For example, if CSYS = 1, an ``RX``, ``RY``, ``RZ`` input of + (1.5,10,3) would scale the specified keypoints 1.5 times in the radial and 3 times in the Z + direction, while adding an offset of 10 degrees to the keypoints.) Zero, blank, or negative + scale factor values are assumed to be 1.0. Zero or blank angular offsets have no effect. + + kinc : str + Increment to be applied to the keypoint numbers for generated set. If zero, the lowest available + keypoint numbers will be assigned ( :ref:`numstr` ). + + noelem : int or str + Specifies whether nodes and elements are also to be generated: + + * ``0`` - Nodes and point elements associated with the original keypoints will be generated (scaled) + if they exist. + + * ``1`` - Nodes and point elements will not be generated. + + imove : int or str + Specifies whether keypoints will be moved or newly defined: + + * ``0`` - Additional keypoints will be generated. + + * ``1`` - Original keypoints will be moved to new position ( ``KINC`` and ``NOELEM`` are ignored). + Use only if the old keypoints are no longer needed at their original positions. Corresponding meshed + items are also moved if not needed at their original position. + + Notes + ----- + + .. _KPSCALE_notes: + + Generates a scaled set of keypoints (and corresponding mesh) from a pattern of keypoints. The MAT, + TYPE, REAL, and ESYS attributes are based on the keypoints in the pattern and not the current + settings. Scaling is done in the active coordinate system. Keypoints in the pattern could have been + generated in any coordinate system. However, solid modeling in a toroidal coordinate system is not + recommended. + """ + command = f"KPSCALE,{np1},{np2},{ninc},{rx},{ry},{rz},{kinc},{noelem},{imove}" + return self.run(command, **kwargs) + + def kscale( + self, + kinc: str = "", + np1: str = "", + np2: str = "", + ninc: str = "", + rx: str = "", + ry: str = "", + rz: str = "", + **kwargs, + ): + r"""Generates a scaled pattern of keypoints from a given keypoint pattern. + + Mechanical APDL Command: `KSCALE `_ + + Parameters + ---------- + kinc : str + Do this scaling operation one time, incrementing all keypoints in the given pattern by ``KINC``. + If ``KINC`` = 0, keypoints will be redefined at the scaled locations. + + np1 : str + Scale keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps + of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and pattern is + all selected keypoints ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + Scale keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps + of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and pattern is + all selected keypoints ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + Scale keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps + of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and pattern is + all selected keypoints ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + rx : str + Scale factor ratios. Scaling is relative to the origin of the active coordinate system (RR, Rθ, + RZ for cylindrical, RR, Rθ, RΦ for spherical). If > 1.0, pattern is enlarged. If < 1.0, pattern + is reduced. Ratios each default to 1.0. + + ry : str + Scale factor ratios. Scaling is relative to the origin of the active coordinate system (RR, Rθ, + RZ for cylindrical, RR, Rθ, RΦ for spherical). If > 1.0, pattern is enlarged. If < 1.0, pattern + is reduced. Ratios each default to 1.0. + + rz : str + Scale factor ratios. Scaling is relative to the origin of the active coordinate system (RR, Rθ, + RZ for cylindrical, RR, Rθ, RΦ for spherical). If > 1.0, pattern is enlarged. If < 1.0, pattern + is reduced. Ratios each default to 1.0. + + Notes + ----- + + .. _KSCALE_notes: + + Generates a scaled pattern of keypoints from a given keypoint pattern. Scaling is done in the active + coordinate system (see analogous node scaling ( :ref:`nscale` )). Solid modeling in a toroidal + coordinate system is not recommended. + """ + command = f"KSCALE,{kinc},{np1},{np2},{ninc},{rx},{ry},{rz}" + return self.run(command, **kwargs) + + def ksum(self, **kwargs): + r"""Calculates and prints geometry statistics of the selected keypoints. + + Mechanical APDL Command: `KSUM `_ + + Notes + ----- + + .. _KSUM_notes: + + Calculates and prints geometry statistics (centroid location, moments of inertia, etc.) associated + with the selected keypoints. Geometry items are reported in the global Cartesian coordinate system. + A unit density is assumed, irrespective of any material associations ( :ref:`katt`, :ref:`mat` ). + Items calculated by :ref:`ksum` and later retrieved by a :ref:`get` or :ref:`starvget` command are + valid only if the model is not modified after the :ref:`ksum` command is issued. + """ + command = "KSUM" + return self.run(command, **kwargs) + + def ksymm( + self, + ncomp: str = "", + np1: str = "", + np2: str = "", + ninc: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Generates a reflected set of keypoints. + + Mechanical APDL Command: `KSYMM `_ + + Parameters + ---------- + ncomp : str + Symmetry key: + + * ``X`` - X (or R) symmetry (default). + + * ``Y`` - Y (or θ) symmetry. + + * ``Z`` - Z (or Φ) symmetry. + + np1 : str + Reflect keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps + of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and pattern is + all selected keypoints ( :ref:`ksel` ). If ``Ncomp`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + Reflect keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps + of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and pattern is + all selected keypoints ( :ref:`ksel` ). If ``Ncomp`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + Reflect keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in steps + of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and pattern is + all selected keypoints ( :ref:`ksel` ). If ``Ncomp`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + kinc : str + Keypoint increment between sets. If zero, the lowest available keypoint numbers are assigned ( + :ref:`numstr` ). + + noelem : int or str + Specifies whether nodes and elements are also to be generated: + + * ``0`` - Generate nodes and point elements associated with the original keypoints, if they exist. + + * ``1`` - Do not generate nodes and elements. + + imove : int or str + Specifies whether keypoints will be moved or newly defined: + + * ``0`` - Generate additional keypoints. + + * ``1`` - Move original keypoints to new position retaining the same keypoint numbers ( ``KINC`` and + ``NOELEM`` are ignored). Valid only if the old keypoints are no longer needed at their original + positions. Corresponding meshed items are also moved if not needed at their original position. + + Notes + ----- + + .. _KSYMM_notes: + + Generates a reflected set of keypoints (and corresponding mesh) from a given keypoint pattern by a + symmetry reflection (see analogous node symmetry command, :ref:`nsym` ). The MAT, TYPE, REAL, and + ESYS attributes are based upon the keypoints in the pattern and not upon the current settings. + Reflection is done in the active coordinate system by changing a particular coordinate sign. + Keypoints in the pattern may have been generated in any coordinate system. However, solid modeling + in a toroidal coordinate system is not recommended. + """ + command = f"KSYMM,{ncomp},{np1},{np2},{ninc},{kinc},{noelem},{imove}" + return self.run(command, **kwargs) + + def ktran( + self, + kcnto: str = "", + np1: str = "", + np2: str = "", + ninc: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Transfers a pattern of keypoints to another coordinate system. + + Mechanical APDL Command: `KTRAN `_ + + Parameters + ---------- + kcnto : str + Reference number of coordinate system where the pattern is to be transferred. Transfer occurs + from the active coordinate system. + + np1 : str + Transfer keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in + steps of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and + pattern is all selected keypoints ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + np2 : str + Transfer keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in + steps of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and + pattern is all selected keypoints ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + ninc : str + Transfer keypoints from pattern beginning with ``NP1`` to ``NP2`` (defaults to ``NP1`` ) in + steps of ``NINC`` (defaults to 1). If ``NP1`` = ALL, ``NP2`` and ``NINC`` are ignored and + pattern is all selected keypoints ( :ref:`ksel` ). If ``NP1`` = P, graphical picking is enabled + and all remaining command fields are ignored (valid only in the GUI). A component name may also + be substituted for ``NP1`` ( ``NP2`` and ``NINC`` are ignored). + + kinc : str + Keypoint increment between sets. If zero, the lowest available keypoint numbers are assigned ( + :ref:`numstr` ). + + noelem : int or str + Specifies whether nodes and elements are also to be generated: + + * ``0`` - Generate nodes and point elements associated with the original keypoints, if they exist. + + * ``1`` - Do not generate nodes and elements. + + imove : int or str + Specifies whether keypoints will be moved or newly defined: + + * ``0`` - Generate additional keypoints. + + * ``1`` - Move original keypoints to new position retaining the same keypoint numbers ( ``KINC`` and + ``NOELEM`` are ignored). Valid only if the old keypoints are no longer needed at their original + positions. Corresponding meshed items are also moved if not needed at their original position. + + Notes + ----- + + .. _KTRAN_notes: + + Transfers a pattern of keypoints (and corresponding mesh) from one coordinate system to another (see + analogous node transfer command, :ref:`transfer` ). The MAT, TYPE, REAL, and ESYS attributes are + based upon the keypoints in the pattern and not upon the current settings. Coordinate systems may be + translated and rotated relative to each other. Initial pattern may be generated in any coordinate + system. Coordinate values are interpreted in the active coordinate system and are transferred + directly. Solid modeling in a toroidal coordinate system is not recommended. + """ + command = f"KTRAN,{kcnto},{np1},{np2},{ninc},{kinc},{noelem},{imove}" + return self.run(command, **kwargs) + + def source(self, x: str = "", y: str = "", z: str = "", **kwargs): + r"""Defines a default location for undefined nodes or keypoints. + + Mechanical APDL Command: `SOURCE `_ + + Parameters + ---------- + x : str + Global Cartesian coordinates for source nodes or keypoints (defaults to the origin). + + y : str + Global Cartesian coordinates for source nodes or keypoints (defaults to the origin). + + z : str + Global Cartesian coordinates for source nodes or keypoints (defaults to the origin). + + Notes + ----- + + .. _SOURCE_notes: + + Defines a global Cartesian location for undefined nodes or keypoints moved during intersection + calculations ( :ref:`move` or :ref:`kmove` ). + """ + command = f"SOURCE,{x},{y},{z}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/prep7/lines.py b/src/ansys/mapdl/core/_commands/prep7/lines.py new file mode 100644 index 00000000000..6eb9311b02a --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/lines.py @@ -0,0 +1,1905 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from ansys.mapdl.core._commands import parse + + +class Lines: + + def bsplin( + self, + p1: str = "", + p2: str = "", + p3: str = "", + p4: str = "", + p5: str = "", + p6: str = "", + xv1: str = "", + yv1: str = "", + zv1: str = "", + xv6: str = "", + yv6: str = "", + zv6: str = "", + **kwargs, + ): + r"""Generates a single line from a spline fit to a series of keypoints. + + Mechanical APDL Command: `BSPLIN `_ + + Parameters + ---------- + p1 : str + Keypoints through which a spline is fit. At least two keypoints must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + The following fields are used only if specified end slopes are desired; otherwise, zero + curvature end slopes will be automatically calculated. The slope vector is parallel to a vector + pointing from the origin of the active coordinate system ( :ref:`csys` ) to the position in + space that XV, YV, ZV represents in that system. + + p2 : str + Keypoints through which a spline is fit. At least two keypoints must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + The following fields are used only if specified end slopes are desired; otherwise, zero + curvature end slopes will be automatically calculated. The slope vector is parallel to a vector + pointing from the origin of the active coordinate system ( :ref:`csys` ) to the position in + space that XV, YV, ZV represents in that system. + + p3 : str + Keypoints through which a spline is fit. At least two keypoints must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + The following fields are used only if specified end slopes are desired; otherwise, zero + curvature end slopes will be automatically calculated. The slope vector is parallel to a vector + pointing from the origin of the active coordinate system ( :ref:`csys` ) to the position in + space that XV, YV, ZV represents in that system. + + p4 : str + Keypoints through which a spline is fit. At least two keypoints must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + The following fields are used only if specified end slopes are desired; otherwise, zero + curvature end slopes will be automatically calculated. The slope vector is parallel to a vector + pointing from the origin of the active coordinate system ( :ref:`csys` ) to the position in + space that XV, YV, ZV represents in that system. + + p5 : str + Keypoints through which a spline is fit. At least two keypoints must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + The following fields are used only if specified end slopes are desired; otherwise, zero + curvature end slopes will be automatically calculated. The slope vector is parallel to a vector + pointing from the origin of the active coordinate system ( :ref:`csys` ) to the position in + space that XV, YV, ZV represents in that system. + + p6 : str + Keypoints through which a spline is fit. At least two keypoints must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + The following fields are used only if specified end slopes are desired; otherwise, zero + curvature end slopes will be automatically calculated. The slope vector is parallel to a vector + pointing from the origin of the active coordinate system ( :ref:`csys` ) to the position in + space that XV, YV, ZV represents in that system. + + xv1 : str + Orientation point of an outward vector tangent to line at ``P1``. Vector coordinate system has + its origin at the keypoint. Coordinate interpretation corresponds to the active coordinate + system type, that is, X is R for cylindrical, etc. Defaults to zero curvature slope. + + yv1 : str + Orientation point of an outward vector tangent to line at ``P1``. Vector coordinate system has + its origin at the keypoint. Coordinate interpretation corresponds to the active coordinate + system type, that is, X is R for cylindrical, etc. Defaults to zero curvature slope. + + zv1 : str + Orientation point of an outward vector tangent to line at ``P1``. Vector coordinate system has + its origin at the keypoint. Coordinate interpretation corresponds to the active coordinate + system type, that is, X is R for cylindrical, etc. Defaults to zero curvature slope. + + xv6 : str + Orientation point of an outward vector tangent to a line at ``P6`` (or the last keypoint + specified if fewer than six specified). Defaults to zero curvature slope. + + yv6 : str + Orientation point of an outward vector tangent to a line at ``P6`` (or the last keypoint + specified if fewer than six specified). Defaults to zero curvature slope. + + zv6 : str + Orientation point of an outward vector tangent to a line at ``P6`` (or the last keypoint + specified if fewer than six specified). Defaults to zero curvature slope. + + Returns + ------- + int + Line number of the spline generated from the spline fit. + + Notes + ----- + + .. _BSPLIN_notes: + + One line is generated between keypoint ``P1`` and the last keypoint entered. The line will pass + through each entered keypoint. Solid modeling in a toroidal coordinate system is not recommended. + + Examples + -------- + Generate a spline through ``(0, 0, 0)``, ``(0, 1, 0)`` and + ``(1, 2, 0)`` + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 1, 0) + >>> k2 = mapdl.k("", 1, 2, 0) + >>> lnum = mapdl.bsplin(k0, k1, k2) + """ + command = ( + f"BSPLIN,{p1},{p2},{p3},{p4},{p5},{p6},{xv1},{yv1},{zv1},{xv6},{yv6},{zv6}" + ) + return parse.parse_line_no(self.run(command, **kwargs)) + + def circle( + self, + pcent: str = "", + rad: str = "", + paxis: str = "", + pzero: str = "", + arc: str = "", + nseg: str = "", + **kwargs, + ): + r"""Generates circular arc lines. + + Mechanical APDL Command: `CIRCLE `_ + + Parameters + ---------- + pcent : str + Keypoint defining the center of the circle (in the plane of the circle). If ``PCENT`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + rad : str + Radius of the circle. If ``RAD`` is blank and ``PCENT`` = P, the radius is the distance from + ``PCENT`` to ``PZERO``. + + paxis : str + Keypoint defining axis of circle (along with ``PCENT`` ). If ``PCENT`` = P and ``PAXIS`` is + omitted, the axis is normal to the working plane. + + pzero : str + Keypoint defining the plane normal to circle (along with ``PCENT`` and ``PAXIS`` ) and the zero + degree location. Need not be in the plane of the circle. This value is not required if ``PAXIS`` + is defined along the Y axis (that is, a circle in the XZ plane). + + arc : str + Arc length (in degrees). Positive follows right-hand rule about ``PCENT`` - ``PAXIS`` + vector. Defaults to 360°. + + nseg : str + Number of lines around circumference (defaults to minimum required for 90°-maximum arcs, that + is, 4 for 360°). Number of keypoints generated is ``NSEG`` for 360° or ``NSEG`` + 1 for less + than 360°. + + Returns + ------- + list + List of lines of the circular arcs generated from this + command. + + Notes + ----- + + .. _CIRCLE_notes: + + Generates circular arc lines (and their corresponding keypoints). Keypoints are generated at regular + angular locations (based on a maximum spacing of 90°). Arc lines are generated connecting the + keypoints. Keypoint and line numbers are automatically assigned, beginning with the lowest available + values ( :ref:`numstr` ). Adjacent lines use a common keypoint. Line shapes are generated as arcs, + regardless of the active coordinate system. Line shapes are invariant with coordinate system after + they are generated. + + Examples + -------- + Create a full circle containing four circular arcs. Circle + centered at (0, 0, 0) and generated in the XY plane. Return + the lines generated from the circle. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 0, 1) + >>> carc0 = mapdl.circle(k0, 1, k1) + >>> carc0 + [1, 2, 3, 4] + """ + command = f"CIRCLE,{pcent},{rad},{paxis},{pzero},{arc},{nseg}" + return parse.parse_line_nos(self.run(command, **kwargs)) + + def l( + self, + p1: str = "", + p2: str = "", + ndiv: str = "", + space: str = "", + xv1: str = "", + yv1: str = "", + zv1: str = "", + xv2: str = "", + yv2: str = "", + zv2: str = "", + **kwargs, + ): + r"""Defines a line between two keypoints. + + Mechanical APDL Command: `L `_ + + Parameters + ---------- + p1 : str + Keypoint at the beginning of line. If ``P1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). + + p2 : str + Keypoint at the end of line. + + ndiv : str + Number of element divisions within this line. Normally this field is not used; specifying + divisions with :ref:`lesize`, etc. is recommended. + + space : str + Spacing ratio. Normally this field is not used, as specifying spacing ratios with the + :ref:`lesize` command is recommended. If positive, ``SPACE`` is the nominal ratio of the last + division size (at ``P2`` ) to the first division size (at ``P1`` ). If the ratio is greater than + 1, the division sizes increase from ``P1`` to ``P2``, and if less than 1, they decrease. If + ``SPACE`` is negative, then \| ``SPACE`` \| is the nominal ratio of the center division size to + those at the ends. + + xv1 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P1`` end of the line. The tail of the vector is at the origin of the + coordinate system. + + yv1 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P1`` end of the line. The tail of the vector is at the origin of the + coordinate system. + + zv1 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P1`` end of the line. The tail of the vector is at the origin of the + coordinate system. + + xv2 : str + Location of the head of the "slope vector" corresponding to the slope at the ``P2`` end of the + line. + + yv2 : str + Location of the head of the "slope vector" corresponding to the slope at the ``P2`` end of the + line. + + zv2 : str + Location of the head of the "slope vector" corresponding to the slope at the ``P2`` end of the + line. + + Returns + ------- + int + The line number of the generated line. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + .. _L_notes: + + Defines a line between two keypoints from ``P1`` to ``P2``. The line shape may be generated as + "straight" (in the active coordinate system) or curved. The line shape is invariant with coordinate + system after it is generated. Note that solid modeling in a toroidal coordinate system is not + recommended. A curved line is limited to 180°. Lines may be redefined only if not yet attached to an + area. + + Examples + -------- + Create a line between the two keypoints (0, 0, 0) and (1, 0, 0) + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 0, 0) + >>> lnum = mapdl.l(k0, k1) + >>> lnum + 1 + """ + command = f"L,{p1},{p2},{ndiv},{space},{xv1},{yv1},{zv1},{xv2},{yv2},{zv2}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def l2ang( + self, + nl1: str = "", + nl2: str = "", + ang1: str = "", + ang2: str = "", + phit1: str = "", + phit2: str = "", + **kwargs, + ): + r"""Generates a line at an angle with two existing lines. + + Mechanical APDL Command: `L2ANG `_ + + Parameters + ---------- + nl1 : str + Number of the first line to be hit (touched by the end of the new line). If negative, assume + ``P1`` (see below) is the second keypoint of the line instead of the first. If ``NL1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + nl2 : str + Number of the second line to be hit. If negative, assume ``P3`` is the second keypoint of the + line instead of the first. + + ang1 : str + Angle of intersection (usually zero or 180) of generated line with tangent to first line. + + ang2 : str + Angle of intersection (usually zero or 180) of generated line with tangent to second line. + + phit1 : str + Number to be assigned to keypoint generated at hit location on first line (defaults to lowest + available keypoint number ( :ref:`numstr` )). + + phit2 : str + Number to be assigned to keypoint generated at hit location on second line (defaults to lowest + available keypoint number ( :ref:`numstr` )). + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _L2ANG_notes: + + Generates a straight line ( ``PHIT1`` - ``PHIT2`` ) at an angle ( ``ANG1`` ) with an existing line + ``NL1`` ( ``P1`` - ``P2`` ) and which is also at an angle ( ``ANG2`` ) with another existing line + ``NL2`` ( ``P3`` - ``P4`` ). If the angles are zero the generated line is tangent to the two lines. + The ``PHIT1`` and ``PHIT2`` locations on the lines are automatically calculated. Line ``P1`` - + ``P2`` becomes ``P1`` - ``PHIT1``, ``P3`` - ``P4`` becomes ``P3`` - ``PHIT2``, and new lines + ``PHIT1`` - ``P2``, ``PHIT2`` - ``P4``, and ``PHIT1`` - ``PHIT2`` are generated. Line divisions are + set to zero (use :ref:`lesize`, etc. to modify). + + Examples + -------- + Create two circles and join them with a line. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 0, 1) + >>> k2 = mapdl.k("", 0, 0, 0.5) + >>> carc0 = mapdl.circle(k0, 1, k1) + >>> carc1 = mapdl.circle(k2, 1, k1) + >>> lnum = mapdl.l2ang(carc0[0], carc1[0], 90, 90) + >>> lnum + 9 + """ + command = f"L2ANG,{nl1},{nl2},{ang1},{ang2},{phit1},{phit2}" + msg = self.run(command, **kwargs) + if msg: + return parse.parse_line_no(msg) + + def l2tan(self, nl1: str = "", nl2: str = "", **kwargs): + r"""Generates a line tangent to two lines. + + Mechanical APDL Command: `L2TAN `_ + + Parameters + ---------- + nl1 : str + Number of the first line generated line is tangent to. If negative, assume ``P1`` (see below) is + the second keypoint of the line instead of the first. If ``NL1`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). + + nl2 : str + Number of the second line generated line is tangent to. If negative, assume ``P3`` is the second + keypoint of the line instead of the first. + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _L2TAN_notes: + + Generates a line ( ``P2`` - ``P3`` ) tangent at point ``P2`` to line ``NL1`` ( ``P1`` - ``P2`` ) and + tangent at point ``P3`` to line ``NL2`` ( ``P3`` - ``P4`` ). + + Examples + -------- + Create two circular arcs and connect them with a spline. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 0, 1) + >>> k2 = mapdl.k("", -1.5, 1.5, 0) + >>> k3 = mapdl.k("", -1.5, 1.5, 1) + >>> carc0 = mapdl.circle(k0, 1, k1, arc=90) + >>> carc1 = mapdl.circle(k2, 1, k3, arc=90) + >>> lnum = mapdl.l2tan(1, 2) + 3 + + Plot these lines + + >>> mapdl.lplot(cpos='xy') + """ + command = f"L2TAN,{nl1},{nl2}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def lang( + self, + nl1: str = "", + p3: str = "", + ang: str = "", + phit: str = "", + locat: str = "", + **kwargs, + ): + r"""Generates a straight line at an angle with a line. + + Mechanical APDL Command: `LANG `_ + + Parameters + ---------- + nl1 : str + Number of the line to be hit (touched by the end of the new line). If negative, assume ``P1`` + (see below) is the second keypoint of the line instead of the first. If ``NL1`` = P, graphical + picking is enabled and all remaining command fields are ignored (valid only in the GUI). + + p3 : str + Keypoint at which generated line must end. + + ang : str + Angle of intersection of generated line ``PHIT`` - ``P3`` with tangent to line ``P1`` - ``P2`` + at ``PHIT``. If 0 (default), the generated line is tangent to ``NL1`` toward end P1; if 90, the + generated line is perpendicular to ``NL1``. If 180, the generated line is tangent to NL1 toward + end P2. ``ANG`` can be any value, but is adjusted to the corresponding acute angle with respect + to ``LOCAT``. See :ref:`LANG_notes` for a discussion of accuracy. + + phit : str + Number to be assigned to keypoint generated at hit location (defaults to lowest available + keypoint number ( :ref:`numstr` )). + + locat : str + Approximate location of ``PHIT`` in terms of the ratio of the distance along the line ( ``NL1`` + ) to the length of the line. ``LOCAT`` can range from 0 to 1. If ``LOCAT`` is blank, the point + will be located with less speed and accuracy, and an arbitrary location may result. + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _LANG_notes: + + Generates a straight line ( ``PHIT`` - ``P3`` ) at an angle ( ``ANG`` ) with a line ``NL1`` ( ``P1`` + - ``P2`` ). The location of ``PHIT`` on the line is automatically calculated. Line ``P1`` - ``P2`` + becomes ``P1`` - ``PHIT`` and new lines ``PHIT`` - ``P2`` and ``PHIT`` - ``P3`` are generated. Line + divisions are set to zero (use :ref:`lesize`, etc. to modify). + + ``PHIT`` is positioned closest to ``LOCAT`` for the given angle, ``ANG``. To ensure better + performance, it is recommended that ``LOCAT`` be input, even if it is 0. + + The program uses an iterative procedure to position ``PHIT``. The procedure is not exact, with the + result that the actual value of ``ANG`` will sometimes differ slightly from the specified value. + + Examples + -------- + Create a line from a line from (0, 0, 0) to (1, 0, 0) to a + keypoint at (1, 1, 1) at an angle of 60 degrees. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 0, 0) + >>> lnum = mapdl.l(k0, k1) + >>> k2 = mapdl.k("", 1, 1, 0) + >>> lnum = mapdl.lang(lnum, k2, 60) + >>> lnum + 2 + """ + command = f"LANG,{nl1},{p3},{ang},{phit},{locat}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def larc(self, p1: str = "", p2: str = "", pc: str = "", rad: str = "", **kwargs): + r"""Defines a circular arc. + + Mechanical APDL Command: `LARC `_ + + Parameters + ---------- + p1 : str + Keypoint at one end of circular arc line. If ``P1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). + + p2 : str + Keypoint at other end of circular arc line. + + pc : str + Keypoint defining plane of arc and center of curvature side (with positive radius). Must not lie + along the straight line from ``P1`` to ``P2``. ``PC`` need not be at the center of curvature. + + rad : str + Radius of curvature of the arc. If negative, assume center of curvature side is opposite to that + defined by ``PC``. If ``RAD`` is blank, ``RAD`` will be calculated from a curve fit through + ``P1``, ``PC``, and ``P2``. + + Returns + ------- + int + Line number of the arc. + + Notes + ----- + + .. _LARC_notes: + + Defines a circular arc line from ``P1`` to ``P2``. The line shape is generated as circular, + regardless of the active coordinate system. The line shape is invariant with coordinate system after + it is generated. + + When dealing with a large radius arc (1e3), or if the location of the arc you create is far away + from the origin of your coordinate system, anomalies may occur. You can prevent this by creating the + arc at a smaller scale, and then scaling the model back to full size ( :ref:`lsscale` ). + + Examples + -------- + Create a circular arc that travels between (0, 0, 0) and + (1, 1, 0) with a radius of curvature of 2. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 1, 0) + >>> k2 = mapdl.k("", 0, 1, 0) + >>> lnum = mapdl.larc(k0, k1, k2, 2) + 1 + """ + command = f"LARC,{p1},{p2},{pc},{rad}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def larea(self, p1: str = "", p2: str = "", narea: str = "", **kwargs): + r"""Generates the shortest line between two keypoints on an area. + + Mechanical APDL Command: `LAREA `_ + + Parameters + ---------- + p1 : str + First keypoint of line to be generated. If ``P1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). + + p2 : str + Second keypoint of line to be generated. + + narea : str + Area containing ``P1`` and ``P2``, or area to which generated line is to be parallel. + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _LAREA_notes: + + Generates the shortest line between two keypoints, ``P1`` and ``P2``, both of which lie on an area. + The generated line will also lie on the area. ``P1`` and ``P2`` may also be equidistant (in global + Cartesian space) from the area (and on the same side of the area), in which case a line parallel to + the area is generated. + + Examples + -------- + Generate a line on a square between its two corners. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 0, 0) + >>> k2 = mapdl.k("", 1, 1, 0) + >>> k3 = mapdl.k("", 0, 1, 0) + >>> a0 = mapdl.a(k0, k1, k2, k3) + >>> lnum = mapdl.larea(k0, k2, a0) + >>> lnum + 1 + """ + command = f"LAREA,{p1},{p2},{narea}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def lcomb(self, nl1: str = "", nl2: str = "", keep: str = "", **kwargs): + r"""Combines adjacent lines into one line. + + Mechanical APDL Command: `LCOMB `_ + + Parameters + ---------- + nl1 : str + Number of the first line to be combined. If ``NL1`` = ALL, ``NL2`` is ignored and all selected + lines ( :ref:`lsel` ) are combined. If ``NL1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). A component name may also be + substituted for ``NL1`` ( ``NL2`` is ignored). + + nl2 : str + Number of the second line to be combined. + + keep : int or str + Specifies whether to keep the input entities: + + * ``0`` - Delete lines ``NL1`` and ``NL2`` and their common keypoint. Keypoints will not be deleted + if they are meshed or if they are attached to other lines. Lines will not be deleted if they are + attached to different areas. + + * ``1`` - Keep ``NL1``, ``NL2``, and their common keypoint. (The common keypoint will not be + attached to the output line.) + + Returns + ------- + int + Line number of the combined line. + + Notes + ----- + + .. _LCOMB_notes: + + Combines adjacent lines into one line (the output line). This operation will effectively "undo" the + :ref:`ldiv` operation. Line divisions are set to zero (use :ref:`lesize`, etc. to modify). Lines + attached to the same area(s) can also be combined. See also the :ref:`lccat` command for line + concatenation capability. + + Examples + -------- + Create two lines and combine them. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 0, 0) + >>> k2 = mapdl.k("", 2, 0, 0) + >>> l0 = mapdl.l(k0, k1) + >>> l1 = mapdl.l(k0, k2) + >>> lout = mapdl.lcomb(l0, l1) + >>> lout + 1 + """ + command = f"LCOMB,{nl1},{nl2},{keep}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def ldele( + self, + nl1: str = "", + nl2: str = "", + ninc: str = "", + kswp: int | str = "", + **kwargs, + ): + r"""Deletes unmeshed lines. + + Mechanical APDL Command: `LDELE `_ + + Parameters + ---------- + nl1 : str + Delete lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to + 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and all selected lines ( :ref:`lsel` ) + are deleted. If ``NL1`` = P, graphical picking is enabled and all remaining command fields are + ignored (valid only in the GUI). A component name may also be substituted for ``NL1`` ( ``NL2`` + and ``NINC`` are ignored). + + nl2 : str + Delete lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to + 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and all selected lines ( :ref:`lsel` ) + are deleted. If ``NL1`` = P, graphical picking is enabled and all remaining command fields are + ignored (valid only in the GUI). A component name may also be substituted for ``NL1`` ( ``NL2`` + and ``NINC`` are ignored). + + ninc : str + Delete lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to + 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and all selected lines ( :ref:`lsel` ) + are deleted. If ``NL1`` = P, graphical picking is enabled and all remaining command fields are + ignored (valid only in the GUI). A component name may also be substituted for ``NL1`` ( ``NL2`` + and ``NINC`` are ignored). + + kswp : int or str + Specifies whether keypoints are also to be deleted: + + * ``0`` - Delete lines only. + + * ``1`` - Delete lines, as well as keypoints attached to lines but not attached to other lines. + + Notes + ----- + + .. _LDELE_notes: + + A line attached to an area cannot be deleted unless the area is first deleted. + """ + command = f"LDELE,{nl1},{nl2},{ninc},{kswp}" + return self.run(command, **kwargs) + + def ldiv( + self, + nl1: str = "", + ratio: str = "", + pdiv: str = "", + ndiv: str = "", + keep: int | str = "", + **kwargs, + ): + r"""Divides a single line into two or more lines. + + Mechanical APDL Command: `LDIV `_ + + Parameters + ---------- + nl1 : str + Number of the line to be divided. If negative, assume ``P1`` (see below) is the second keypoint + of the line instead of the first for ``RATIO``. If ALL, divide all selected lines ( :ref:`lsel` + ). If ``NL1`` = P, graphical picking is enabled and all remaining command fields are ignored + (valid only in the GUI). A component name may also be substituted for ``NL1``. + + ratio : str + Ratio of line length ``P1`` - ``PDIV`` to line length ``P1`` - ``P2``. Must be between 0.0 and + 1.0. Input ignored if ``NDIV`` > 2. + + pdiv : str + Number to be assigned to keypoint generated at division location (defaults to lowest available + keypoint number ( :ref:`numstr` )). Input ignored if ``NL1`` = ALL or ``NDIV`` > 2. If ``PDIV`` + already exists and lies on line ``NL1``, divide line at ``PDIV`` ( ``RATIO`` must also be 0.0). + If ``PDIV`` already exists and does not lie on line ``NL1``, ``PDIV`` is projected and moved to + the nearest point on line ``NL1`` (if possible). ``PDIV`` cannot be attached to another line, + area, or volume. + + ndiv : str + The number of new lines to be generated from old line (defaults to 2). + + keep : int or str + Specifies whether to keep the input entities: + + * ``0`` - Modify old line to use new keypoints and slopes. + + * ``1`` - Do not modify old line. New lines will overlay old line and have unique keypoints. + + Notes + ----- + + .. _LDIV_notes: + + Divides a single line ``NL1`` (defined from keypoint ``P1`` to keypoint ``P2`` ) into two or more + lines. Line ``NL1`` becomes the new line beginning with keypoint ``P1`` and new lines are generated + ending at keypoint ``P2``. If the line is attached to an area, the area will also be updated. Line + divisions are set to zero (use :ref:`lesize`, etc. to modify). + """ + command = f"LDIV,{nl1},{ratio},{pdiv},{ndiv},{keep}" + return self.run(command, **kwargs) + + def ldrag( + self, + nk1: str = "", + nk2: str = "", + nk3: str = "", + nk4: str = "", + nk5: str = "", + nk6: str = "", + nl1: str = "", + nl2: str = "", + nl3: str = "", + nl4: str = "", + nl5: str = "", + nl6: str = "", + **kwargs, + ): + r"""Generates lines by sweeping a keypoint pattern along path. + + Mechanical APDL Command: `LDRAG `_ + + Parameters + ---------- + nk1 : str + List of keypoints in the pattern to be dragged (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except those that define the drag path) will be + swept along the path. A component name may also be substituted for ``NK1``. + + nk2 : str + List of keypoints in the pattern to be dragged (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except those that define the drag path) will be + swept along the path. A component name may also be substituted for ``NK1``. + + nk3 : str + List of keypoints in the pattern to be dragged (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except those that define the drag path) will be + swept along the path. A component name may also be substituted for ``NK1``. + + nk4 : str + List of keypoints in the pattern to be dragged (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except those that define the drag path) will be + swept along the path. A component name may also be substituted for ``NK1``. + + nk5 : str + List of keypoints in the pattern to be dragged (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except those that define the drag path) will be + swept along the path. A component name may also be substituted for ``NK1``. + + nk6 : str + List of keypoints in the pattern to be dragged (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except those that define the drag path) will be + swept along the path. A component name may also be substituted for ``NK1``. + + nl1 : str + List of lines defining the path along which the pattern is to be dragged (6 maximum if using + keyboard entry). Must be a continuous set of lines. + + nl2 : str + List of lines defining the path along which the pattern is to be dragged (6 maximum if using + keyboard entry). Must be a continuous set of lines. + + nl3 : str + List of lines defining the path along which the pattern is to be dragged (6 maximum if using + keyboard entry). Must be a continuous set of lines. + + nl4 : str + List of lines defining the path along which the pattern is to be dragged (6 maximum if using + keyboard entry). Must be a continuous set of lines. + + nl5 : str + List of lines defining the path along which the pattern is to be dragged (6 maximum if using + keyboard entry). Must be a continuous set of lines. + + nl6 : str + List of lines defining the path along which the pattern is to be dragged (6 maximum if using + keyboard entry). Must be a continuous set of lines. + + Notes + ----- + + .. _LDRAG_notes: + + Generates lines (and their corresponding keypoints) by sweeping a given keypoint pattern along a + characteristic drag path. If the drag path consists of multiple lines, the drag direction is + determined by the sequence in which the path lines are input ( ``NL1``, ``NL2``, etc.). If the drag + path is a single line ( ``NL1`` ), the drag direction is from the keypoint on the drag line that is + closest to the first keypoint of the given pattern to the other end of the drag line. + + The magnitude of the vector between the keypoints of the given pattern and the first path keypoint + remains constant for all generated keypoint patterns and the path keypoints. The direction of the + vector relative to the path slope also remains constant so that patterns may be swept around curves. + Keypoint and line numbers are automatically assigned (beginning with the lowest available values ( + :ref:`numstr` )). For best results, the entities to be dragged should be orthogonal to the start of + the drag path. Drag operations that produce an error message may create some of the desired entities + prior to terminating. + """ + command = f"LDRAG,{nk1},{nk2},{nk3},{nk4},{nk5},{nk6},{nl1},{nl2},{nl3},{nl4},{nl5},{nl6}" + return self.run(command, **kwargs) + + def lextnd( + self, nl1: str = "", nk1: str = "", dist: str = "", keep: str = "", **kwargs + ): + r"""Extends a line at one end by using its slope. + + Mechanical APDL Command: `LEXTND `_ + + Parameters + ---------- + nl1 : str + Number of the line to be extended. If ``NL1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). + + nk1 : str + Number of keypoint at the end of line ``NL1`` to be extended. + + dist : str + Distance that the line will be extended. + + keep : int or str + Specifies whether to keep the input entities: + + * ``0`` - Modify old line to use new keypoints and slopes. + + * ``1`` - Do not modify old line. New line will overlay old line and have unique keypoints. + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _LEXTND_notes: + + Extends a line at one end by using its slope. Lines may be redefined only if not yet attached to an + area. Line divisions are set to zero (use :ref:`lesize`, etc. to modify). Note that solid modeling + in a toroidal coordinate system is not recommended. + + Examples + -------- + Create a circular arc and extend it at one of its keypoints + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 0, 1) + >>> carcs = mapdl.circle(k0, 1, k1, arc=90) + >>> lnum = mapdl.lextnd(carcs[0], 3, 1) + >>> lnum + 1 + """ + command = f"LEXTND,{nl1},{nk1},{dist},{keep}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def lfillt( + self, nl1: str = "", nl2: str = "", rad: str = "", pcent: str = "", **kwargs + ): + r"""Generates a fillet line between two intersecting lines. + + Mechanical APDL Command: `LFILLT `_ + + Parameters + ---------- + nl1 : str + Number of the first intersecting line. If ``NL1`` = P, graphical picking is enabled and all + remaining command fields are ignored (valid only in the GUI). + + nl2 : str + Number of the second intersecting line. + + rad : str + Radius of fillet to be generated. Radius should be less than the lengths of the two lines + specified with ``NL1`` and ``NL2``. + + pcent : str + Number to be assigned to generated keypoint at fillet arc center. If zero (or blank), no + keypoint is generated. + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _LFILLT_notes: + + Generates a fillet line between two intersecting lines ``NL1`` ( ``P1`` - ``PINT`` ) and ``NL2`` ( + ``P2`` - ``PINT`` ). Three keypoints may be generated, two at the fillet tangent points ( ``PTAN1`` + and ``PTAN2`` ) and one (optional) at the fillet arc center ( ``PCENT`` ). Line ``P1`` - ``PINT`` + becomes ``P1`` - ``PTAN1``, ``P2`` - ``PINT`` becomes ``P2`` - ``PTAN2``, and new arc line ``PTAN1`` + - ``PTAN2`` is generated. Generated keypoint and line numbers are automatically assigned (beginning + with the lowest available values ( :ref:`numstr` )). Line divisions are set to zero (use + :ref:`lesize`, etc. to modify). + + Examples + -------- + Create two intersecting lines at a right angle and add a + fillet between them. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 1, 0) + >>> k2 = mapdl.k("", 1, 0, 0) + >>> l0 = mapdl.l(k0, k1) + >>> l1 = mapdl.l(k0, k2) + >>> lnum = mapdl.lfillt(l0, l1, 0.25) + 3 + """ + command = f"LFILLT,{nl1},{nl2},{rad},{pcent}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def lgen( + self, + itime: str = "", + nl1: str = "", + nl2: str = "", + ninc: str = "", + dx: str = "", + dy: str = "", + dz: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Generates additional lines from a pattern of lines. + + Mechanical APDL Command: `LGEN `_ + + Parameters + ---------- + itime : str + Do this generation operation a total of ``ITIME`` s, incrementing all keypoints in the given + pattern automatically (or by ``KINC`` ) each time after the first. ``ITIME`` must be > 1 for + generation to occur. + + nl1 : str + Generate lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + nl2 : str + Generate lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + ninc : str + Generate lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + dx : str + Keypoint location increments in the active coordinate system (--, Dθ, DZ for cylindrical, --, + Dθ, -- for spherical). + + dy : str + Keypoint location increments in the active coordinate system (--, Dθ, DZ for cylindrical, --, + Dθ, -- for spherical). + + dz : str + Keypoint location increments in the active coordinate system (--, Dθ, DZ for cylindrical, --, + Dθ, -- for spherical). + + kinc : str + Keypoint increment between generated sets. If zero, the lowest available keypoint numbers are + assigned ( :ref:`numstr` ). + + noelem : int or str + Specifies if elements and nodes are also to be generated: + + * ``0`` - Generate nodes and elements associated with the original lines, if they exist. + + * ``1`` - Do not generate nodes and elements. + + imove : int or str + Specifies whether to redefine the existing lines: + + * ``0`` - Generate additional lines as requested with the ``ITIME`` argument. + + * ``1`` - Move original lines to new position retaining the same keypoint numbers ( ``ITIME``, + ``KINC``, and ``NOELM`` are ignored). Valid only if the old lines are no longer needed at their + original positions. Corresponding meshed items are also moved if not needed at their original + position. + + Notes + ----- + + .. _LGEN_notes: + + Generates additional lines (and their corresponding keypoints and mesh) from a given line pattern. + The MAT, TYPE, REAL, and ESYS attributes are based upon the lines in the pattern and not upon the + current settings. End slopes of the generated lines remain the same (in the active coordinate + system) as those of the given pattern. For example, radial slopes remain radial, etc. Generations + which produce lines of a size or shape different from the pattern (that is, radial generations in + cylindrical systems, radial and phi generations in spherical systems, and theta generations in + elliptical systems) are not allowed. Note that solid modeling in a toroidal coordinate system is not + recommended. New line numbers are automatically assigned (beginning with the lowest available values + ( :ref:`numstr` )). + """ + command = ( + f"LGEN,{itime},{nl1},{nl2},{ninc},{dx},{dy},{dz},{kinc},{noelem},{imove}" + ) + return self.run(command, **kwargs) + + def llist( + self, nl1: str = "", nl2: str = "", ninc: str = "", lab: str = "", **kwargs + ): + r"""Lists the defined lines. + + Mechanical APDL Command: `LLIST `_ + + Parameters + ---------- + nl1 : str + List lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to 1). + If ``NL1`` = ALL (default), ``NL2`` and ``NINC`` are ignored and all selected lines ( + :ref:`lsel` ) are listed. If ``NL1`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for ``NL1`` + ( ``NL2`` and ``NINC`` are ignored). + + nl2 : str + List lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to 1). + If ``NL1`` = ALL (default), ``NL2`` and ``NINC`` are ignored and all selected lines ( + :ref:`lsel` ) are listed. If ``NL1`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for ``NL1`` + ( ``NL2`` and ``NINC`` are ignored). + + ninc : str + List lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to 1). + If ``NL1`` = ALL (default), ``NL2`` and ``NINC`` are ignored and all selected lines ( + :ref:`lsel` ) are listed. If ``NL1`` = P, graphical picking is enabled and all remaining command + fields are ignored (valid only in the GUI). A component name may also be substituted for ``NL1`` + ( ``NL2`` and ``NINC`` are ignored). + + lab : str + Determines what type of listing is used (one of the following): + + * ``(blank)`` - Prints information about all lines in the specified range. + + * ``RADIUS`` - Prints the radius of certain circular arcs, along with the keypoint numbers of each + line. Straight lines, non-circular curves, and circular arcs not internally identified as arcs + (which depends upon how each arc is created) will print a radius value of zero. + + * ``LAYER`` - Prints layer-mesh control specifications. + + * ``HPT`` - Prints information about only those lines that contain hard points. HPT is not supported + in the GUI. + + * ``ORIENT`` - Prints a list of lines, and identifies any orientation keypoints and any cross + section IDs that are associated with the lines. Used for beam meshing with defined orientation nodes + and cross sections. + + Notes + ----- + + .. _LLIST_notes: + + There are 2 listings for the number of element divisions and the spacing ratio. The first listing + shows assignments from :ref:`lesize` only, followed by the "hard" key ( ``KYNDIV`` ). See + :ref:`lesize` for more information. The second listing shows ``NDIV`` and ``SPACE`` for the existing + mesh, if one exists. Whether this existing mesh and the mesh generated by :ref:`lesize` match at any + given point depends upon meshing options and the sequence of meshing operations. + + A -1 in the nodes column indicates that the line has been meshed but that there are no interior + nodes. + + An attribute (TYPE, MAT, REAL, or ESYS) listed as a zero is unassigned; one listed as a positive + value indicates that the attribute was assigned with the :ref:`latt` command (and will not be reset + to zero if the mesh is cleared); one listed as a negative value indicates that the attribute was + assigned using the attribute pointer ( :ref:`type`, :ref:`mat`, :ref:`real`, or :ref:`esys` ) that + was active during meshing (and will be reset to zero if the mesh is cleared). + + This command is valid in any processor. + """ + command = f"LLIST,{nl1},{nl2},{ninc},{lab}" + return self.run(command, **kwargs) + + def lplot(self, nl1: str = "", nl2: str = "", ninc: str = "", **kwargs): + r"""Displays the selected lines. + + Mechanical APDL Command: `LPLOT `_ + + Parameters + ---------- + nl1 : str + Display lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to + 1). If ``NL1`` = ALL (default), ``NL2`` and ``NINC`` are ignored and display all selected lines + ( :ref:`lsel` ). + + nl2 : str + Display lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to + 1). If ``NL1`` = ALL (default), ``NL2`` and ``NINC`` are ignored and display all selected lines + ( :ref:`lsel` ). + + ninc : str + Display lines from ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of ``NINC`` (defaults to + 1). If ``NL1`` = ALL (default), ``NL2`` and ``NINC`` are ignored and display all selected lines + ( :ref:`lsel` ). + + Notes + ----- + + .. _LPLOT_notes: + + Mesh divisions on plotted lines are controlled by the ``LDIV`` option of the :ref:`psymb` command. + + This command is valid in any processor. + """ + command = f"LPLOT,{nl1},{nl2},{ninc}" + return self.run(command, **kwargs) + + def lreverse(self, lnum: str = "", noeflip: int | str = "", **kwargs): + r"""Reverses the normal of a line, regardless of its connectivity or mesh status. + + Mechanical APDL Command: `LREVERSE `_ + + Parameters + ---------- + lnum : str + Line number of the line whose normal direction is to be reversed. If ``LNUM`` = ALL, the normals + of all selected lines will be reversed. If ``LNUM`` = P, graphical picking is enabled. A + component name may also be substituted for ``LNUM``. + + noeflip : int or str + Indicates whether you want to change the normal direction of the existing elements on the reversed + line(s) so that they are consistent with each line's new normal direction. + + * ``0`` - Make the normal direction of existing elements on the reversed line(s) consistent with + each line's new normal direction (default). + + * ``1`` - Do not change the normal direction of existing elements on the reversed line(s). + + Notes + ----- + + .. _LREVERSE_notes: + + You cannot use the :ref:`lreverse` command to change the normal direction of any element that has a + body or surface load. We recommend that you apply all of your loads only after ensuring that the + element normal directions are acceptable. + + Real constants (such as nonuniform shell thickness and tapered beam constants) may be invalidated by + an element reversal. + + For more information, see `Revising Your Model + `_ in the + `Modeling and Meshing Guide + `_. + """ + command = f"LREVERSE,{lnum},{noeflip}" + return self.run(command, **kwargs) + + def lrotat( + self, + nk1: str = "", + nk2: str = "", + nk3: str = "", + nk4: str = "", + nk5: str = "", + nk6: str = "", + pax1: str = "", + pax2: str = "", + arc: str = "", + nseg: str = "", + **kwargs, + ): + r"""Generates circular lines by rotating a keypoint pattern about an axis. + + Mechanical APDL Command: `LROTAT `_ + + Parameters + ---------- + nk1 : str + List of keypoints in the pattern to be rotated (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except ``PAX1`` and ``PAX2`` ) will define the + pattern to be rotated. A component name may also be substituted for ``NK1``. + + nk2 : str + List of keypoints in the pattern to be rotated (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except ``PAX1`` and ``PAX2`` ) will define the + pattern to be rotated. A component name may also be substituted for ``NK1``. + + nk3 : str + List of keypoints in the pattern to be rotated (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except ``PAX1`` and ``PAX2`` ) will define the + pattern to be rotated. A component name may also be substituted for ``NK1``. + + nk4 : str + List of keypoints in the pattern to be rotated (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except ``PAX1`` and ``PAX2`` ) will define the + pattern to be rotated. A component name may also be substituted for ``NK1``. + + nk5 : str + List of keypoints in the pattern to be rotated (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except ``PAX1`` and ``PAX2`` ) will define the + pattern to be rotated. A component name may also be substituted for ``NK1``. + + nk6 : str + List of keypoints in the pattern to be rotated (6 maximum if using keyboard entry). If ``NK1`` = + P, graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). If ``NK1`` = ALL, all selected keypoints (except ``PAX1`` and ``PAX2`` ) will define the + pattern to be rotated. A component name may also be substituted for ``NK1``. + + pax1 : str + Keypoints defining the axis about which the keypoint pattern is to be rotated. + + pax2 : str + Keypoints defining the axis about which the keypoint pattern is to be rotated. + + arc : str + Arc length (in degrees). Positive follows right-hand rule about ``PAX1`` - ``PAX2`` vector. + Defaults to 360. + + nseg : str + Number of lines (8 maximum) around circumference. Defaults to minimum required for 90° (maximum) + arcs, that is, 4 for 360°, 3 for 270°, etc. + + Notes + ----- + + .. _LROTAT_notes: + + Generates circular lines (and their corresponding keypoints) by rotating a keypoint pattern about an + axis. Keypoint patterns are generated at regular angular locations (based on a maximum spacing of + 90°). Line patterns are generated at the keypoint patterns. Keypoint and line numbers are + automatically assigned (beginning with the lowest available values ( :ref:`numstr` )). + """ + command = ( + f"LROTAT,{nk1},{nk2},{nk3},{nk4},{nk5},{nk6},{pax1},{pax2},{arc},{nseg}" + ) + return self.run(command, **kwargs) + + def lsscale( + self, + nl1: str = "", + nl2: str = "", + ninc: str = "", + rx: str = "", + ry: str = "", + rz: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Generates a scaled set of lines from a pattern of lines. + + Mechanical APDL Command: `LSSCALE `_ + + Parameters + ---------- + nl1 : str + Set of lines ( ``NL1`` to ``NL2`` in steps of ``NINC`` ) that defines the pattern to be scaled. + ``NL2`` defaults to ``NL1``, ``NINC`` defaults to 1. If ``NL1`` = ALL, ``NL2`` and ``NINC`` are + ignored and the pattern is defined by all selected lines. If ``NL1`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). A component name + may also be substituted for ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + nl2 : str + Set of lines ( ``NL1`` to ``NL2`` in steps of ``NINC`` ) that defines the pattern to be scaled. + ``NL2`` defaults to ``NL1``, ``NINC`` defaults to 1. If ``NL1`` = ALL, ``NL2`` and ``NINC`` are + ignored and the pattern is defined by all selected lines. If ``NL1`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). A component name + may also be substituted for ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + ninc : str + Set of lines ( ``NL1`` to ``NL2`` in steps of ``NINC`` ) that defines the pattern to be scaled. + ``NL2`` defaults to ``NL1``, ``NINC`` defaults to 1. If ``NL1`` = ALL, ``NL2`` and ``NINC`` are + ignored and the pattern is defined by all selected lines. If ``NL1`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). A component name + may also be substituted for ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + rx : str + Scale factors to be applied to the X, Y, Z keypoint coordinates in active coordinate system ( + RR, R θ, RZ for cylindrical; RR, R θ, R Φ for spherical). Note that the R θ and R Φ scale + factors are interpreted as angular offsets. For example, for :ref:`csys`,1, RR, R θ, RZ input of + (1.5,10,3) would scale the specified keypoints 1.5 times in the radial and 3 times in the Z + direction, while adding an offset of 10 degrees to the keypoints. Zero, blank, or negative scale + factor values are assumed to be 1.0. Zero or blank angular offsets have no effect. + + ry : str + Scale factors to be applied to the X, Y, Z keypoint coordinates in active coordinate system ( + RR, R θ, RZ for cylindrical; RR, R θ, R Φ for spherical). Note that the R θ and R Φ scale + factors are interpreted as angular offsets. For example, for :ref:`csys`,1, RR, R θ, RZ input of + (1.5,10,3) would scale the specified keypoints 1.5 times in the radial and 3 times in the Z + direction, while adding an offset of 10 degrees to the keypoints. Zero, blank, or negative scale + factor values are assumed to be 1.0. Zero or blank angular offsets have no effect. + + rz : str + Scale factors to be applied to the X, Y, Z keypoint coordinates in active coordinate system ( + RR, R θ, RZ for cylindrical; RR, R θ, R Φ for spherical). Note that the R θ and R Φ scale + factors are interpreted as angular offsets. For example, for :ref:`csys`,1, RR, R θ, RZ input of + (1.5,10,3) would scale the specified keypoints 1.5 times in the radial and 3 times in the Z + direction, while adding an offset of 10 degrees to the keypoints. Zero, blank, or negative scale + factor values are assumed to be 1.0. Zero or blank angular offsets have no effect. + + kinc : str + Increment to be applied to keypoint numbers for generated set. If zero, the lowest available + keypoint numbers will be assigned ( :ref:`numstr` ). + + noelem : int or str + Specifies whether nodes and elements are also to be generated: + + * ``0`` - Nodes and line elements associated with the original lines will be generated (scaled) if + they exist. + + * ``1`` - Nodes and line elements will not be generated. + + imove : int or str + Specifies whether lines will be moved or newly defined: + + * ``0`` - Additional lines will be generated. + + * ``1`` - Original lines will be moved to new position ( ``KINC`` and ``NOELEM`` are ignored). Use + only if the old lines are no longer needed at their original positions. Corresponding meshed items + are also moved if not needed at their original position. + + Notes + ----- + + .. _LSSCALE_notes: + + This command generates a scaled set of lines (and their corresponding keypoints and mesh) from a + pattern of lines. + + The MAT, TYPE, REAL, and ESYS attributes are based on the lines in the pattern and not the current + settings. + + Scaling occurs in the active coordinate system. Lines in the pattern could have been generated in + any coordinate system. + """ + command = f"LSSCALE,{nl1},{nl2},{ninc},{rx},{ry},{rz},{kinc},{noelem},{imove}" + return self.run(command, **kwargs) + + def lstr(self, p1: str = "", p2: str = "", **kwargs): + r"""Defines a straight line irrespective of the active coordinate system. + + Mechanical APDL Command: `LSTR `_ + + Parameters + ---------- + p1 : str + Keypoint at the beginning of line. If ``P1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI) + + p2 : str + Keypoint at the end of line. + + Returns + ------- + int + Line number of the generated line. + + Notes + ----- + + .. _LSTR_notes: + + Defines a straight line from ``P1`` to ``P2`` using the global Cartesian coordinate system. The + active coordinate system will be ignored. The line shape is invariant with the coordinate system + after it is generated. Lines may be redefined only if not yet attached to an area. + + Examples + -------- + Create a cartesian straight line regardless of the coordinate + system being in cylindrical. + + >>> mapdl.csys(1) + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 1, 1, 1) + >>> lnum = mapdl.lstr(k0, k1) + >>> lnum + 1 + """ + command = f"LSTR,{p1},{p2}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def lsum(self, **kwargs): + r"""Calculates and prints geometry statistics of the selected lines. + + Mechanical APDL Command: `LSUM `_ + + Notes + ----- + + .. _LSUM_notes: + + Calculates and prints geometry statistics (length, centroid, moments of inertia, etc.) associated + with the selected lines. Geometry items are reported in the global Cartesian coordinate system. A + unit density is assumed, irrespective of any material associations ( :ref:`latt`, :ref:`mat` ). + Items calculated by :ref:`lsum` and later retrieved by a :ref:`get` or :ref:`starvget` command are + valid only if the model is not modified after the :ref:`lsum` command is issued. + """ + command = "LSUM" + return self.run(command, **kwargs) + + def lsymm( + self, + ncomp: str = "", + nl1: str = "", + nl2: str = "", + ninc: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Generates lines from a line pattern by symmetry reflection. + + Mechanical APDL Command: `LSYMM `_ + + Parameters + ---------- + ncomp : str + Symmetry key: + + * ``X`` - X symmetry (default). + + * ``Y`` - Y symmetry. + + * ``Z`` - Z symmetry. + + nl1 : str + Reflect lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + nl2 : str + Reflect lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + ninc : str + Reflect lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + kinc : str + Keypoint increment between sets. If zero, the lowest available keypoint numbers are assigned ( + :ref:`numstr` ). + + noelem : int or str + Specifies whether nodes and elements are also to be generated: + + * ``0`` - Generate nodes and elements associated with the original lines, if they exist. + + * ``1`` - Do not generate nodes and elements. + + imove : int or str + Specifies whether areas will be moved or newly defined: + + * ``0`` - Generate additional lines. + + * ``1`` - Move original lines to new position retaining the same keypoint numbers ( ``KINC`` and + ``NOELEM`` are ignored). Valid only if the old lines are no longer needed at their original + positions. Corresponding meshed items are also moved if not needed at their original position. + + Notes + ----- + + .. _LSYMM_notes: + + Generates a reflected set of lines (and their corresponding keypoints and mesh) from a given line + pattern by a symmetry reflection (see analogous node symmetry command, :ref:`nsym` ). The MAT, TYPE, + REAL, and ESYS attributes are based upon the lines in the pattern and not upon the current settings. + Reflection is done in the active coordinate system by changing a particular coordinate sign. The + active coordinate system must be Cartesian. Lines in the pattern may have been generated in any + coordinate system. However, solid modeling in a toroidal coordinate system is not recommended. Lines + are generated as described in the :ref:`lgen` command. + + See the :ref:`esym` command for additional information about symmetry elements. + """ + command = f"LSYMM,{ncomp},{nl1},{nl2},{ninc},{kinc},{noelem},{imove}" + return self.run(command, **kwargs) + + def ltan( + self, + nl1: str = "", + p3: str = "", + xv3: str = "", + yv3: str = "", + zv3: str = "", + **kwargs, + ): + r"""Generates a line at the end of, and tangent to, an existing line. + + Mechanical APDL Command: `LTAN `_ + + Parameters + ---------- + nl1 : str + Number of the line the generated line is tangent to. If negative, assume ``P1`` (see below), + instead of ``P2``, is the second keypoint of line ``NL1``. If ``NL1`` = P, graphical picking is + enabled and all remaining command fields are ignored (valid only in the GUI). + + p3 : str + Keypoint at which generated line must end. + + xv3 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P3`` end of the line. The tail of the vector is at the coordinate system + origin. + + yv3 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P3`` end of the line. The tail of the vector is at the coordinate system + origin. + + zv3 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P3`` end of the line. The tail of the vector is at the coordinate system + origin. + + Returns + ------- + int + Line number of the line generated. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + .. _LTAN_notes: + + Generates a line ( ``P2`` - ``P3`` ) tangent at end point ( ``P2`` ) of line ``NL1`` ( ``P1`` - + ``P2`` ). + + Examples + -------- + Create a circular arc and generate a tangent spline at the end + of it directed to a new keypoint. + + >>> k0 = mapdl.k("", 0, 0, 0) + >>> k1 = mapdl.k("", 0, 0, 1) + >>> k2 = mapdl.k("", -1, 1.5, 0) + >>> carc = mapdl.circle(k0, 1, k1, arc=90) + >>> lnum = mapdl.ltan(carc[0], k2) + >>> lnum + 2 + """ + command = f"LTAN,{nl1},{p3},{xv3},{yv3},{zv3}" + return parse.parse_line_no(self.run(command, **kwargs)) + + def ltran( + self, + kcnto: str = "", + nl1: str = "", + nl2: str = "", + ninc: str = "", + kinc: str = "", + noelem: int | str = "", + imove: int | str = "", + **kwargs, + ): + r"""Transfers a pattern of lines to another coordinate system. + + Mechanical APDL Command: `LTRAN `_ + + Parameters + ---------- + kcnto : str + Reference number of coordinate system where the pattern is to be transferred. Transfer occurs + from the active coordinate system. The coordinate system type and parameters of ``KCNTO`` must + be the same as the active system. + + nl1 : str + Transfer lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + nl2 : str + Transfer lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + ninc : str + Transfer lines from pattern beginning with ``NL1`` to ``NL2`` (defaults to ``NL1`` ) in steps of + ``NINC`` (defaults to 1). If ``NL1`` = ALL, ``NL2`` and ``NINC`` are ignored and pattern is all + selected lines ( :ref:`lsel` ). If ``NL1`` = P, graphical picking is enabled and all remaining + command fields are ignored (valid only in the GUI). A component name may also be substituted for + ``NL1`` ( ``NL2`` and ``NINC`` are ignored). + + kinc : str + Keypoint increment between sets. If zero, the lowest available keypoint numbers are assigned ( + :ref:`numstr` ). + + noelem : int or str + Specifies whether nodes and elements are also to be generated: + + * ``0`` - Generate nodes and elements associated with the original lines, if they exist. + + * ``1`` - Do not generate nodes and elements. + + imove : int or str + Specifies whether lines will be moved or newly defined: + + * ``0`` - Generate additional lines. + + * ``1`` - Move original lines to new position retaining the same keypoint numbers ( ``KINC`` and + ``NOELM`` are ignored). Valid only if the old lines are no longer needed at their original + positions. Corresponding meshed items are also moved if not needed at their original position. + + Notes + ----- + + .. _LTRAN_notes: + + Transfers a pattern of lines (and their corresponding keypoints and mesh) from one coordinate system + to another (see analogous node transfer command, :ref:`transfer` ). The MAT, TYPE, REAL, and ESYS + attributes are based upon the lines in the pattern and not upon the current settings. Coordinate + systems may be translated and rotated relative to each other. Initial pattern may be generated in + any coordinate system. However, solid modeling in a toroidal coordinate system is not recommended. + Coordinate and slope values are interpreted in the active coordinate system and are transferred + directly. Lines are generated as described in the :ref:`lgen` command. + """ + command = f"LTRAN,{kcnto},{nl1},{nl2},{ninc},{kinc},{noelem},{imove}" + return self.run(command, **kwargs) + + def spline( + self, + p1: str = "", + p2: str = "", + p3: str = "", + p4: str = "", + p5: str = "", + p6: str = "", + xv1: str = "", + yv1: str = "", + zv1: str = "", + xv6: str = "", + yv6: str = "", + zv6: str = "", + **kwargs, + ): + r"""Generates a segmented spline through a series of keypoints. + + Mechanical APDL Command: `SPLINE `_ + + Parameters + ---------- + p1 : str + Keypoints through which the spline is fit. At least two must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + p2 : str + Keypoints through which the spline is fit. At least two must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + p3 : str + Keypoints through which the spline is fit. At least two must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + p4 : str + Keypoints through which the spline is fit. At least two must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + p5 : str + Keypoints through which the spline is fit. At least two must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + p6 : str + Keypoints through which the spline is fit. At least two must be defined. If ``P1`` = P, + graphical picking is enabled and all remaining command fields are ignored (valid only in the + GUI). + + xv1 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P1`` end of the spline. The tail of the vector is at the origin of the + coordinate system. + + yv1 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P1`` end of the spline. The tail of the vector is at the origin of the + coordinate system. + + zv1 : str + Location (in the active coordinate system) of the head of the "slope vector" corresponding to + the slope at the ``P1`` end of the spline. The tail of the vector is at the origin of the + coordinate system. + + xv6 : str + Location of the head of the "slope vector" corresponding to the slope at the ``P6`` (or the last + keypoint if fewer than six specified) end of the spline. + + yv6 : str + Location of the head of the "slope vector" corresponding to the slope at the ``P6`` (or the last + keypoint if fewer than six specified) end of the spline. + + zv6 : str + Location of the head of the "slope vector" corresponding to the slope at the ``P6`` (or the last + keypoint if fewer than six specified) end of the spline. + + Returns + ------- + list + List of line numbers generated. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + .. _SPLINE_notes: + + The output from this command is a series of connected lines (one line between each pair of + keypoints) that together form a spline. Note that solid modeling in a toroidal coordinate system is + not recommended. + + Examples + -------- + Create a spline with 5 keypoints. + + >>> k0 = mapdl.k('', 0, 0, 0) + >>> k1 = mapdl.k('', 0.2, 0.2, 0) + >>> k2 = mapdl.k('', 0.4, 0.3, 0) + >>> k3 = mapdl.k('', 0.6, 0.5, 0) + >>> k4 = mapdl.k('', 0.8, 0.3, 0) + >>> lines = mapdl.spline(k0, k1, k2, k3, k4) + >>> lines + [1, 2, 3, 4] + """ + command = ( + f"SPLINE,{p1},{p2},{p3},{p4},{p5},{p6},{xv1},{yv1},{zv1},{xv6},{yv6},{zv6}" + ) + return parse.parse_line_nos(self.run(command, **kwargs)) + + def ssln(self, fact: str = "", size: str = "", **kwargs): + r"""Selects and displays small lines in the model. + + Mechanical APDL Command: `SSLN `_ + + Parameters + ---------- + fact : str + Factor used to determine small lines. ``FACT`` times the average line length in the model is + used as the line length limit below which lines will be selected. + + size : str + Line length limit for line selection. Lines that have a length less than or equal to ``SIZE`` + will be selected. Used only if ``FACT`` is blank. + + Notes + ----- + + .. _SSLN_notes: + + :ref:`ssln` invokes a predefined Mechanical APDL macro for selecting small lines in a model. Lines + that are + smaller than or equal to the specified limit ( ``FACT`` or ``SIZE`` ) are selected and line numbers + are displayed. This command macro is useful for detecting very small lines in a model that may cause + problems (that is, poorly shaped elements or a meshing failure) during meshing. All lines that are + not "small" will be unselected and can be reselected with the :ref:`lsel` command. + """ + command = f"SSLN,{fact},{size}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/prep7/materials.py b/src/ansys/mapdl/core/_commands/prep7/materials.py new file mode 100644 index 00000000000..42b4e06e1f0 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/materials.py @@ -0,0 +1,2254 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Materials: + + def emunit(self, lab: str = "", value: str = "", **kwargs): + r"""Specifies the system of units for magnetic field problems. + + Mechanical APDL Command: `EMUNIT `_ + + **Command default:** + + .. _EMUNIT_default: + + Rationalized MKS system of units (meters, amperes, henries, webers, etc.). Free-space permeability + is set to 4 πe-7 Henries/meter, free-space permittivity is set to 8.85e-12 Farads/meter. + + Parameters + ---------- + lab : str + Label specifying the type of units: + + * ``MKS`` - Rationalized MKS system of units (meters, amperes, henries, webers, etc.). Free-space + permeability is set to 4 πe-7 henries/meter. Free-space permittivity is set to 8.85 e-12 F/m. + + * ``MUZRO`` - User defined system of units. Free-space permeability is set to the value input for + ``VALUE``. Other units must correspond to the permeability units. Relative permeability may be + altered to absolute values. + + * ``EPZRO`` - User defined system of units. Free-space permittivity is set to the value input for + VALUE. Other units must correspond to the permittivity units. + + value : str + User value of free-space permeability (defaults to 1) if ``Lab`` = MUZRO, or free-space + permittivity (defaults to 1) if ``Lab`` = EPZRO. + + Notes + ----- + + .. _EMUNIT_notes: + + Specifies the system of units to be used for electric and magnetic field problems. The free-space + permeability and permittivity values may be set as desired. These values are used with the relative + property values ( :ref:`mp` ) to establish absolute property values. If the magnetic source field + strength (H:sub:`s` ) has already been calculated ( :ref:`biot` ), switching :ref:`emunit` will not + change the values. + + For micro-electromechanical systems (MEMS), where dimensions are on the order of microns, see the + conversion factors in `System of Units + `_ + in the `Coupled-Field Analysis Guide + `_. + + This command is also valid in SOLUTION. + """ + command = f"EMUNIT,{lab},{value}" + return self.run(command, **kwargs) + + def fc( + self, + mat: str = "", + lab1: str = "", + lab2: str = "", + data1: str = "", + data2: str = "", + data3: str = "", + data4: str = "", + data5: str = "", + data6: str = "", + **kwargs, + ): + r"""Provides failure criteria information and activates a data table to input temperature-dependent + stress and strain limits. + + Mechanical APDL Command: `FC `_ + + Parameters + ---------- + mat : str + Material reference number. You can define failure criteria for up to 250 different materials. + + lab1 : str + Type of data. + + * ``TEMP`` - Temperatures. Each of the materials you define can have a different set of temperatures + to define the failure criteria. + + * ``EPEL`` - Strains. + + * ``S`` - Stresses. + + lab2 : str + Specific criteria. Not used if ``Lab1`` = TEMP. + + * ``XTEN`` - Allowable tensile stress or strain in the x-direction. (Must be positive.) + + * ``XCMP`` - Allowable compressive stress or strain in the x-direction. (Defaults to negative of + XTEN.) + + * ``YTEN`` - Allowable tensile stress or strain in the y-direction. (Must be positive.) + + * ``YCMP`` - Allowable compressive stress or strain in the y-direction. (Defaults to negative of + YTEN.) + + * ``ZTEN`` - Allowable tensile stress or strain in the z-direction. (Must be positive.) + + * ``ZCMP`` - Allowable compressive stress or strain in the z-direction. (Defaults to negative of + ZTEN.) + + * ``XY`` - Allowable XY stress or shear strain. (Must be positive.) + + * ``YZ`` - Allowable YZ stress or shear strain. (Must be positive.) + + * ``XZ`` - Allowable XZ stress or shear strain. (Must be positive.) + + * ``XYCP`` - XY coupling coefficient (Used only if ``Lab1`` = S). Defaults to -1.0. [ + :ref:`FC_arg_note` ] + + * ``YZCP`` - YZ coupling coefficient (Used only if ``Lab1`` = S). Defaults to -1.0. [ + :ref:`FC_arg_note` ] + + * ``XZCP`` - XZ coupling coefficient (Used only if ``Lab1`` = S). Defaults to -1.0. [ + :ref:`FC_arg_note` ] + + * ``XZIT`` - XZ tensile inclination parameter for Puck failure index (default = 0.0) + + * ``XZIC`` - XZ compressive inclination parameter for Puck failure index (default = 0.0) + + * ``YZIT`` - YZ tensile inclination parameter for Puck failure index (default = 0.0) + + * ``YZIC`` - YZ compressive inclination parameter for Puck failure index (default = 0.0) + + * ``G1G2`` - Fracture toughness ratio between GI (mode I) and GII (mode II) + + * ``ETAL`` - Longitudinal friction coefficient + + * ``ETAT`` - Transverse friction coefficient + + * ``APL0`` - Fracture angle under pure transverse compression (default to 53) [ :ref:`FC_arg_note2` + ] + + .. _FC_arg_note: + + Entering a blank or a zero for XYCP, YZCP, or XZCP triggers the default value of -1.0. To specify an + effective zero, use a small, nonzero value (such as 1E-14) instead. For more information, see + :ref:`aPG6vq1bamcm`. + + .. _FC_arg_note2: + + Entering a blank or a zero ALP0 triggers the default value of 53. To specify an effective zero, use + a small, nonzero value (such as 1E-14) instead. For more information, see :ref:`aPG6vq1bamcm`. + + data1 : str + Description of ``DATA1`` through ``DATA6``. + + * ``T1, T2, T3, T4, T5, T6`` - Temperature at which limit data is input. Used only when ``Lab1`` = + TEMP. + + * ``V1, V2, V3, V4, V5, V6`` - Value of limit stress or strain at temperature T1 through T6. Used + only when ``Lab1`` = S or EPEL. + + data2 : str + Description of ``DATA1`` through ``DATA6``. + + * ``T1, T2, T3, T4, T5, T6`` - Temperature at which limit data is input. Used only when ``Lab1`` = + TEMP. + + * ``V1, V2, V3, V4, V5, V6`` - Value of limit stress or strain at temperature T1 through T6. Used + only when ``Lab1`` = S or EPEL. + + data3 : str + Description of ``DATA1`` through ``DATA6``. + + * ``T1, T2, T3, T4, T5, T6`` - Temperature at which limit data is input. Used only when ``Lab1`` = + TEMP. + + * ``V1, V2, V3, V4, V5, V6`` - Value of limit stress or strain at temperature T1 through T6. Used + only when ``Lab1`` = S or EPEL. + + data4 : str + Description of ``DATA1`` through ``DATA6``. + + * ``T1, T2, T3, T4, T5, T6`` - Temperature at which limit data is input. Used only when ``Lab1`` = + TEMP. + + * ``V1, V2, V3, V4, V5, V6`` - Value of limit stress or strain at temperature T1 through T6. Used + only when ``Lab1`` = S or EPEL. + + data5 : str + Description of ``DATA1`` through ``DATA6``. + + * ``T1, T2, T3, T4, T5, T6`` - Temperature at which limit data is input. Used only when ``Lab1`` = + TEMP. + + * ``V1, V2, V3, V4, V5, V6`` - Value of limit stress or strain at temperature T1 through T6. Used + only when ``Lab1`` = S or EPEL. + + data6 : str + Description of ``DATA1`` through ``DATA6``. + + * ``T1, T2, T3, T4, T5, T6`` - Temperature at which limit data is input. Used only when ``Lab1`` = + TEMP. + + * ``V1, V2, V3, V4, V5, V6`` - Value of limit stress or strain at temperature T1 through T6. Used + only when ``Lab1`` = S or EPEL. + + Notes + ----- + + .. _FC_notes: + + The data table can be input in either PREP7 or POST1. This table is used only in POST1. When you + postprocess failure criteria results defined via the :ref:`fc` command ( :ref:`plesol`, + :ref:`presol`, :ref:`plnsol`, :ref:`prnsol`, :ref:`prrsol`, etc.), the active coordinate system must + be the coordinate system of the material being analyzed. You do this using :ref:`rsys`, SOLU. For + layered applications, you also use the :ref:`layer` command. See the specific element documentation + in the `Element Reference + `_ for + information about defining your coordinate system for layers. + + Some plotting and printing functions will not support Failure Criteria for your PowerGraphics + displays. This could result in minor changes to other data when Failure Criteria are applied. See + the appropriate plot or print command documentation for more information. + """ + command = ( + f"FC,{mat},{lab1},{lab2},{data1},{data2},{data3},{data4},{data5},{data6}" + ) + return self.run(command, **kwargs) + + def fccheck(self, **kwargs): + r"""Checks both the strain and stress input criteria for all materials. + + Mechanical APDL Command: `FCCHECK `_ + + Notes + ----- + + .. _FCCHECK_notes: + + Issue the :ref:`fccheck` command to check the completeness of the input during the input phase. + """ + command = "FCCHECK" + return self.run(command, **kwargs) + + def fcdele(self, mat: str = "", **kwargs): + r"""Deletes previously defined failure criterion data for the given material. + + Mechanical APDL Command: `FCDELE `_ + + Parameters + ---------- + mat : str + Material number. Deletes all :ref:`fc` command input for this material. + + A value of ALL deletes all :ref:`fc` command input for all materials. + + Notes + ----- + + .. _FCDELE_notes: + + This command is also valid in POST1. + """ + command = f"FCDELE,{mat}" + return self.run(command, **kwargs) + + def fclist(self, mat: str = "", temp: str = "", **kwargs): + r"""To list what the failure criteria is that you have input. + + Mechanical APDL Command: `FCLIST `_ + + Parameters + ---------- + mat : str + Material number (defaults to ALL for all materials). + + temp : str + Temperature to be evaluated at (defaults to TUNIF). + + Notes + ----- + + .. _FCLIST_notes: + + This command allows you to see what you have already input for failure criteria using the FC + commands. + """ + command = f"FCLIST,{mat},,{temp}" + return self.run(command, **kwargs) + + def mp( + self, + lab: str = "", + mat: str = "", + c0: str = "", + c1: str = "", + c2: str = "", + c3: str = "", + c4: str = "", + **kwargs, + ): + r"""Defines a linear material property as a constant or a function of temperature. + + Mechanical APDL Command: `MP `_ + + Parameters + ---------- + lab : str + Valid material property label. Applicable labels are listed under "Material Properties" in the input + table for each element type in the `Element Reference `_. + + * ``ALPD`` - Mass matrix multiplier for damping. + + * ``ALPX`` - Secant coefficients of thermal expansion (also ALPY, ALPZ). + + * ``BETD`` - Stiffness matrix multiplier for damping. + + * ``BETX`` - Coefficient of diffusion expansion (also BETY, BETZ) + + * ``BVIS`` - Bulk viscosity + + * ``C`` - Specific heat + + * ``CREF`` - Reference concentration (may not be temperature dependent) + + * ``CSAT`` - Saturated concentration + + * ``CTEX`` - Instantaneous coefficients of thermal expansion (also CTEY, CTEZ) + + * ``CVH`` - Heat coefficient at constant volume per unit of mass + + * ``DENS`` - Mass density. + + * ``DMPR`` - Damping ratio. + + * ``DMPS`` - Constant structural damping coefficient. + + * ``DXX`` - Diffusivity coefficients (also DYY, DZZ) + + * ``EMIS`` - Emissivity. For default behavior, see :ref:`Notes. ` + + * ``ENTH`` - Enthalpy. See :ref:`Considerations for Enthalpy. ` + + * ``EX`` - Elastic moduli (also EY, EZ) + + * ``GXY`` - Shear moduli (also GYZ, GXZ) + + * ``HF`` - Convection or film coefficient + + * ``KXX`` - Thermal conductivities (also KYY, KZZ) + + * ``LSST`` - Electric loss tangent + + * ``LSSM`` - Magnetic loss tangent + + * ``MGXX`` - Magnetic coercive forces (also MGYY, MGZZ) + + * ``MURX`` - Magnetic relative permeabilities (also MURY, MURZ) + + * ``MU`` - Coefficient of friction + + * ``NUXY`` - Minor Poisson's ratios (also NUYZ, NUXZ) (NUXY = ν:sub:`yx`, as described in + `Stress-Strain Relationships + `_ + + * ``PERX`` - Electric relative permittivities (also PERY, PERZ) + + If you enter permittivity values less than 1 for ``SOLID5``, ``PLANE13``, or ``SOLID98``, the + program interprets the values as absolute permittivity. Values input for ``PLANE222``, ``PLANE223``, + ``SOLID225``, ``SOLID226``, or ``SOLID227`` are always interpreted as relative permittivity. + + * ``PRXY`` - Major Poisson's ratios (also PRYZ, PRXZ) (PRXY = ν:sub:`xy`, as described in + `Stress-Strain Relationships + `_ + + * ``QRATE`` - Heat generation rate for thermal mass element ``MASS71``. Fraction of plastic work + converted to heat (Taylor-Quinney coefficient) or fraction of viscoelastic loss converted to heat + for coupled- field elements ``PLANE222``, ``PLANE223``, ``SOLID225``, ``SOLID226``, and + ``SOLID227``. + + * ``REFT`` - Reference temperature. Must be defined as a constant; C1 through C4 are ignored. + + * ``RH`` - Hall Coefficient. + + * ``RSVX`` - Electrical resistivities (also RSVY, RSVZ). + + * ``SBKX`` - Seebeck coefficients (also SBKY, SBKZ). + + * ``SONC`` - Sonic velocity. + + * ``THSX`` - Thermal strain (also THSY, THSZ). + + * ``VISC`` - Viscosity. + + mat : str + Material reference number to be associated with the elements (defaults to the current MAT + setting ( :ref:`mat` )). + + c0 : str + Material property value, or if a property-versus-temperature polynomial is being defined, the + constant term in the polynomial. ``C0`` can also be a table name (``tabname``); if ``C0`` is a + table name, ``C1`` through ``C4`` are ignored. + + c1 : str + Coefficients of the linear, quadratic, cubic, and quartic terms, respectively, in the property- + versus-temperature polynomial. Leave blank (or set to zero) for a constant material property. + + c2 : str + Coefficients of the linear, quadratic, cubic, and quartic terms, respectively, in the property- + versus-temperature polynomial. Leave blank (or set to zero) for a constant material property. + + c3 : str + Coefficients of the linear, quadratic, cubic, and quartic terms, respectively, in the property- + versus-temperature polynomial. Leave blank (or set to zero) for a constant material property. + + c4 : str + Coefficients of the linear, quadratic, cubic, and quartic terms, respectively, in the property- + versus-temperature polynomial. Leave blank (or set to zero) for a constant material property. + + Notes + ----- + + .. _MP_notes: + + :ref:`mp` defines a linear material property as a constant or in terms of a fourth order polynomial + as a function of temperature. (See the :ref:`tb` command for nonlinear material property input.) + Linear material properties typically require a single substep for solution, whereas nonlinear + material properties require multiple substeps. + + If the constants C1 - C4 are input, the polynomial + + Property = ``C0`` + ``C1`` (T) + ``C2`` (T) :sup:`2` + ``C3`` (T) :sup:`3` + ``C4`` (T) :sup:`4` + + is evaluated at discrete temperature points with linear interpolation between points (that is, a + piecewise linear representation) and a constant-valued extrapolation beyond the extreme points. + First-order properties use two discrete points (±9999°). The :ref:`mptemp` or :ref:`mptgen` commands + must be used for second and higher order properties to define appropriate temperature steps. To + ensure that the number of temperatures defined via the :ref:`mptemp` and :ref:`mptgen` commands is + minimally sufficient for a reasonable representation of the curve, Mechanical APDL generates an + error + message if the number is less than N, and a warning message if the number is less than 2N. The value + N represents the highest coefficient used; for example, if C3 is nonzero and C4 is zero, a cubic + curve is being used which is defined using 4 coefficients so that N = 4. + + Some elements (for example, ``FLUID116`` ) support tabular input for material properties. Use the + :ref:`dim` command to create the table of property values as a function of the independent + variables. Then input this table name ( ``C0`` = ``tabname``) when defining the property via the + :ref:`mp` command. Tabular material properties are calculated before the first iteration (that is, + using initial values ( :ref:`ic` )). For a list of elements that support tabular material properties + and associated primary variables, see `Defining Linear Material Properties Using Tabular Input + `_ + + When defining a reference temperature ( :ref:`mp`,REFT), you can convert temperature-dependent + secant coefficients of thermal expansion (SCTE) data from the definition temperature to the + reference temperature. To do so, issue the :ref:`mpamod` command. + + This command is also valid in SOLUTION. + + .. _MP_enthalpy_notes: + + Considerations for Enthalpy ( ``Lab`` = ENTH) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + * To ensure correct results, you must define enthalpy over a large enough temperature range to span + all computed temperatures during the solution. The :ref:`tb` command does not extrapolate enthalpy + values beyond the specified temp range like the :ref:`mp` command does. + + * If both the :ref:`tb` and :ref:`mp` commands are used to specify enthalpy values, enthalpy values + defined via the :ref:`tb` command are used and those defined via the :ref:`mp` command are + ignored. + + .. _MP_EMIS_notes: + + Default behavior for Emissivity ( ``Lab`` = EMIS) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + There is no :ref:`command default value for emissivity, and you must specify it by issuing + ` :ref:`mp`,EMIS. Otherwise, an error message appears. If you issue :ref:`mp`,EMIS + without specifying ``C0``, ``C1``, ``C2``, ``C3``, ``C4`` values, emissivity defaults to 0. + + .. _MPprodRest: + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + """ + command = f"MP,{lab},{mat},{c0},{c1},{c2},{c3},{c4}" + return self.run(command, **kwargs) + + def mpamod(self, mat: str = "", deftemp: str = "", **kwargs): + r"""Modifies temperature-dependent secant coefficients of thermal expansion. + + Mechanical APDL Command: `MPAMOD `_ + + Parameters + ---------- + mat : str + Material number for which the secant coefficients of thermal expansion (SCTE's) are to be + modified. Defaults to 1. + + deftemp : str + Definition temperature at which the existing SCTE-versus-temperature tables were defined. + Defaults to zero. + + Notes + ----- + + .. _MPAMOD_notes: + + This command converts temperature-dependent SCTE data (properties ALPX, ALPY, ALPZ) from the + definition temperature ( ``DEFTEMP`` ) to the reference temperature defined by :ref:`mp`,REFT or + :ref:`tref`. If both the :ref:`mp`,REFT and :ref:`tref` commands have been issued, the reference + temperature defined by the :ref:`mp`,REFT command will be used. + + This command does not apply to the instantaneous coefficients of thermal expansion (properties CTEX, + CTEY, CTEZ) or to the thermal strains (properties THSX, THSY, THSZ). + + This command is also valid in SOLUTION. + """ + command = f"MPAMOD,{mat},{deftemp}" + return self.run(command, **kwargs) + + def mpchg(self, mat: str = "", elem: str = "", **kwargs): + r"""Changes the material number attribute of an element. + + Mechanical APDL Command: `MPCHG `_ + + Parameters + ---------- + mat : str + Assign this material number to the element. Material numbers are defined with the material + property commands ( :ref:`mp` ). + + elem : str + Element for material change. If ALL, change materials for all selected elements ( :ref:`esel` ). + + Notes + ----- + + .. _MPCHG_notes: + + Changes the material number of the specified element. Between load steps in SOLUTION, material + properties cannot be changed from linear to nonlinear, nonlinear to linear, or from one nonlinear + option to another. + + If you change from one CHABOCHE model to another CHABOCHE model, the different models need to have + the same number of data points. + """ + command = f"MPCHG,{mat},{elem}" + return self.run(command, **kwargs) + + def mpcopy(self, matf: str = "", matt: str = "", **kwargs): + r"""Copies linear material model data from one material reference number to another. + + Mechanical APDL Command: `MPCOPY `_ + + Parameters + ---------- + + matf : str + Material reference number from where material property data will be copied. + + matt : str + Material reference number to where material property data will be copied. + + Notes + ----- + + .. _MPCOPY_notes: + + The :ref:`mpcopy` command copies linear material properties only, which are all properties defined + through the :ref:`mp` command. If you copy a model that includes both linear and yield behavior + constants (for example, a BKIN model), the :ref:`mpcopy` and :ref:`tbcopy`, ALL commands are used + together to copy the entire model. All input data associated with the model is copied, that is, all + data defined through the :ref:`mp` and :ref:`tb` commands. + + Also, if you copy a material model using the `Material Model Interface + `_ + ( Edit> Copy ), both the commands :ref:`mpcopy` and :ref:`tbcopy`, ALL are issued, + regardless of whether the model includes linear constants only, or if it includes a combination of + linear and yield behavior constants. + + This command is also valid in SOLUTION. + """ + command = f"MPCOPY,,{matf},{matt}" + return self.run(command, **kwargs) + + def mpdata( + self, + lab: str = "", + mat: str = "", + sloc: str = "", + c1: str = "", + c2: str = "", + c3: str = "", + c4: str = "", + c5: str = "", + c6: str = "", + **kwargs, + ): + r"""Defines property data to be associated with the temperature table. + + Mechanical APDL Command: `MPDATA `_ + + Parameters + ---------- + lab : str + Valid property label. Applicable labels are listed under "Material Properties" in the input table + for each element type in the `Element Reference `_. + + * ``ALPD`` - Mass matrix multiplier for damping. + + * ``ALPX`` - Secant coefficients of thermal expansion (also ALPY, ALPZ). (See also :ref:`mpamod` + command for adjustment to reference temperature). + + * ``BETD`` - Stiffness matrix multiplier for damping. + + * ``BETX`` - Coefficient of diffusion expansion (also BETY, BETZ) + + * ``C`` - Specific heat. + + * ``CREF`` - Reference concentration (may not be temperature dependent) + + * ``CSAT`` - Saturated concentration + + * ``CTEX`` - Instantaneous coefficients of thermal expansion (also CTEY, CTEZ). + + * ``DENS`` - Mass density. + + * ``DMPS`` - Constant material damping coefficient. + + * ``DXX`` - Diffusivity coefficients (also DYY, DZZ) + + * ``EMIS`` - Emissivity. + + * ``ENTH`` - Enthalpy. + + * ``EX`` - Elastic moduli (also EY, EZ). + + * ``GXY`` - Shear moduli (also GYZ, GXZ). + + * ``HF`` - Convection or film coefficient. + + * ``KXX`` - Thermal conductivities (also KYY, KZZ). + + * ``LSST`` - Dielectric loss tangent. + + * ``MGXX`` - Magnetic coercive forces (also MGYY, MGZZ). + + * ``MU`` - Coefficient of friction. + + * ``MURX`` - Magnetic relative permeabilities (also MURY, MURZ). + + * ``NUXY`` - Minor Poisson's ratios (also NUYZ, NUXZ). + + * ``PERX`` - Electric relative permittivities (also PERY, PERZ). + + * ``PRXY`` - Major Poisson's ratios (also PRYZ, PRXZ). + + * ``QRATE`` - Heat generation rate. + + * ``REFT`` - Reference temperature (may not be temperature dependent). + + * ``RH`` - Hall Coefficient. + + * ``RSVX`` - Electrical resistivities (also RSVY, RSVZ). + + * ``SBKX`` - Seebeck coefficients (also SBKY, SBKZ). + + * ``SONC`` - Sonic velocity. + + * ``THSX`` - Thermal strain (also THSY, THSZ). + + * ``VISC`` - Viscosity. + + mat : str + Material reference number to be associated with the elements (defaults to 1 if you specify zero + or no material number). + + sloc : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + c1 : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + c2 : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + c3 : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + c4 : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + c5 : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + c6 : str + Property data values assigned to six locations starting with ``SLOC``. If a value is already in + this location, it is redefined. A blank (or zero) value for ``C1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``C1``. Blank (or zero) values for + ``C2`` to ``C6`` leave the corresponding previous values unchanged. + + Notes + ----- + + .. _MPDATA_notes: + + Defines a table of property data to be associated with the temperature table. Repeat :ref:`mpdata` + command for additional values (100 maximum). Temperatures must be defined first ( :ref:`mptemp` ). + Also stores assembled property function table (temperature and data) in virtual space. + + This command is also valid in SOLUTION. + + .. _MPDATA_extranote1: + + Ansys Mechanical Enterprise The command :ref:`mpdata`,LSST is only available to the Ansys Mechanical + Enterprise product family (Ansys Mechanical Enterprise, Ansys Mechanical Enterprise PrepPost, + and Ansys Mechanical Enterprise Solver). + """ + command = f"MPDATA,{lab},{mat},{sloc},{c1},{c2},{c3},{c4},{c5},{c6}" + return self.run(command, **kwargs) + + def mpdele( + self, + lab: str = "", + mat1: str = "", + mat2: str = "", + inc: str = "", + lchk: str = "", + **kwargs, + ): + r"""Deletes linear material properties. + + Mechanical APDL Command: `MPDELE `_ + + Parameters + ---------- + lab : str + Material property label (see :ref:`mp` command for valid labels). If ALL, delete properties for + all applicable labels. + + mat1 : str + Delete materials from ``MAT1`` to ``MAT2`` (defaults to ``MAT1`` ) in steps of ``INC`` (defaults + to 1). If ``MAT1`` = ALL, ``MAT2`` and ``INC`` are ignored and the properties for all materials + are deleted. + + mat2 : str + Delete materials from ``MAT1`` to ``MAT2`` (defaults to ``MAT1`` ) in steps of ``INC`` (defaults + to 1). If ``MAT1`` = ALL, ``MAT2`` and ``INC`` are ignored and the properties for all materials + are deleted. + + inc : str + Delete materials from ``MAT1`` to ``MAT2`` (defaults to ``MAT1`` ) in steps of ``INC`` (defaults + to 1). If ``MAT1`` = ALL, ``MAT2`` and ``INC`` are ignored and the properties for all materials + are deleted. + + lchk : str + Specifies the level of element-associativity checking: + + * ``NOCHECK`` - No element-associativity check occurs. This option is the default. + + * ``WARN`` - When a section, material, or real constant is associated with an element, Mechanical APDL + issues a message warning that the necessary entity has been deleted. + + * ``CHECK`` - The command terminates, and no section, material, or real constant is deleted if it is + associated with an element. + + Notes + ----- + + .. _MPDELE_notes: + + This command is also valid in SOLUTION. + + The ``LCHK`` argument is valid only when ``Lab`` = ALL. + """ + command = f"MPDELE,{lab},{mat1},{mat2},{inc},{lchk}" + return self.run(command, **kwargs) + + def mpdres( + self, labf: str = "", matf: str = "", labt: str = "", matt: str = "", **kwargs + ): + r"""Reassembles existing material data with the temperature table. + + Mechanical APDL Command: `MPDRES `_ + + Parameters + ---------- + labf : str + Material property label associated with ``MATF``. + + matf : str + Material reference number of property to restore from virtual space. + + labt : str + Material property label associated with ``MATT`` (defaults to label associated with ``MATF`` ). + + matt : str + Material reference number assigned to generated property (defaults to ``MATF`` ). + + Notes + ----- + + .. _MPDRES_notes: + + Restores into the database (from virtual space) a data table previously defined ( :ref:`mp` ) for a + particular property, assembles data with current database temperature table, and stores back in + virtual space as a new property. + + This command is also valid in SOLUTION. + """ + command = f"MPDRES,{labf},{matf},{labt},{matt}" + return self.run(command, **kwargs) + + def mplib(self, r_w_opt: str = "", path: str = "", **kwargs): + r"""Sets the default material library read and write paths. + + Mechanical APDL Command: `/MPLIB `_ + + Parameters + ---------- + r_w_opt : str + Determines what path is being set. Possible values are: + + * ``READ`` - Set the read path. + + * ``WRITE`` - Set the write path. + + * ``STAT`` - Report what read and write paths are currently in use. + + path : str + The directory path to be used for material library files. + + Notes + ----- + + .. _s-MPLIB_notes: + + The :ref:`mplib` command sets two path strings used in conjunction with the material library feature + and the :ref:`mpread` and :ref:`mpwrite` commands. + + For :ref:`mpread`, when you use the ``LIB`` option and no directory path is given in the file name, + the command searches for the file in these locations: the current working directory, the user's home + directory, the user-specified material library directory (as defined by the :ref:`mplib`,READ, + ``PATH`` command), and :file:`/ansys_dir/matlib`. + + For :ref:`mpwrite`, when you use the ``LIB`` option and the directory portion of the specification + for the material library file is blank, the command writes the material library file to the + directory specified by the :ref:`mplib`,WRITE, ``PATH`` command (if that path has been set). If the + path has not been set, the default is to write the file to the current working directory. + + The Material Library files supplied with the distribution media are meant for demonstration purposes + only. These files are not intended for use in customer applications. + """ + command = f"/MPLIB,{r_w_opt},{path}" + return self.run(command, **kwargs) + + def mplist( + self, + mat1: str = "", + mat2: str = "", + inc: str = "", + lab: str = "", + tevl: str = "", + **kwargs, + ): + r"""Lists linear material properties. + + Mechanical APDL Command: `MPLIST `_ + + Parameters + ---------- + mat1 : str + List materials from ``MAT1`` to ``MAT2`` (defaults to ``MAT1`` ) in steps of ``INC`` (defaults + to 1). If ``MAT1`` = ALL (default), ``MAT2`` and ``INC`` are ignored and properties for all + material numbers are listed. + + mat2 : str + List materials from ``MAT1`` to ``MAT2`` (defaults to ``MAT1`` ) in steps of ``INC`` (defaults + to 1). If ``MAT1`` = ALL (default), ``MAT2`` and ``INC`` are ignored and properties for all + material numbers are listed. + + inc : str + List materials from ``MAT1`` to ``MAT2`` (defaults to ``MAT1`` ) in steps of ``INC`` (defaults + to 1). If ``MAT1`` = ALL (default), ``MAT2`` and ``INC`` are ignored and properties for all + material numbers are listed. + + lab : str + Material property label (see the :ref:`mp` command for labels). If ALL (or blank), list + properties for all labels. If EVLT, list properties for all labels evaluated at TEVL. + + tevl : str + Evaluation temperature for ``Lab`` = EVLT listing (defaults to :ref:`bfunif` ). + + Notes + ----- + + .. _MPLIST_notes: + + For ``Lab`` = EVLT, when the property is from tables, the :ref:`mpplot` command will not be + valid because the property could be a function of more than temperature. + + This command is valid in any processor. + """ + command = f"MPLIST,{mat1},{mat2},{inc},{lab},{tevl}" + return self.run(command, **kwargs) + + def mpplot( + self, + lab: str = "", + mat: str = "", + tmin: str = "", + tmax: str = "", + pmin: str = "", + pmax: str = "", + **kwargs, + ): + r"""Plots linear material properties as a function of temperature. + + Mechanical APDL Command: `MPPLOT `_ + + Parameters + ---------- + lab : str + Linear material property label (EX, EY, etc.) ( :ref:`mp` ). + + mat : str + Material reference number. Defaults to 1. + + tmin : str + Minimum abscissa value to be displayed. + + tmax : str + Maximum abscissa value. + + pmin : str + Minimum property (ordinate) value to be displayed. + + pmax : str + Maximum property value. + + Notes + ----- + + .. _MPPLOT_notes: + + When the property is from tables, the :ref:`mpplot` command will not be valid because the property + could be a f unction of more than temperature. + + This command is valid in any processor. + """ + command = f"MPPLOT,{lab},{mat},{tmin},{tmax},{pmin},{pmax}" + return self.run(command, **kwargs) + + def mpread(self, fname: str = "", ext: str = "", lib: str = "", **kwargs): + r"""Reads a file containing material properties. + + Mechanical APDL Command: `MPREAD `_ + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including directory). If you do not + specify the ``LIB`` option, the default directory is the current working directory. If you + specify the ``LIB`` option, the default is the following search path: the current working + directory, the user's home directory, MPLIB_DIR (as specified by the :ref:`mplib`,READ, ``PATH`` + command) and :file:`/ansys_dir/matlib` (as defined by installation). If you use the default for + your directory, you can use all 248 characters for the file name. + + The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). If you omit the default extension is MP. extension + is units_MPL, where units is the system of units currently in use. (See the description of the + :ref:`units` command.) For example, if :ref:`units` is set to SI, the extension defaults to + SI_MPL. + + lib : str + Reads material library files previously written with the :ref:`mpwrite` command. (See the + description of the LIB option for the :ref:`mpwrite` command.) The only allowed value for LIB is + LIB. + + The LIB field indicates that the specified file was written by :ref:`mpwrite` using the LIB + option, and that the file is consistent with the material library file format. When the + :ref:`mpread` command executes, Mechanical APDL reads material properties defined in the + specified file into the current Mechanical APDL working database. The currently selected + material, as defined by the :ref:`mat` command ( :ref:`mat`,MAT), determines the material number + used when reading the material properties. The LIB option for :ref:`mpread` and :ref:`mpwrite` + supports storing and retrieving both linear and nonlinear properties. + + Notes + ----- + + .. _MPREAD_notes: + + Material properties written to a file without the LIB option do not support nonlinear properties. + Also, properties written to a file without the LIB option are restored in the same material number + as originally defined. To avoid errors, use :ref:`mpread` with the LIB option only when reading + files written using :ref:`mpwrite` with the LIB option. + + If you omit the LIB option for :ref:`mpread`, this command supports only linear properties. + + Material numbers are hardcoded. If you write a material file without specifying the LIB option, then + read that file in via the :ref:`mpread` command with the LIB option, Mechanical APDL does not write + the + file to a new material number; instead, it writes the file to the old material number (the number + specified on the :ref:`mpwrite` command that created the file.) + + This command is also valid in SOLUTION. + """ + command = f"MPREAD,{fname},{ext},,{lib}" + return self.run(command, **kwargs) + + def mptemp( + self, + sloc: str = "", + t1: str = "", + t2: str = "", + t3: str = "", + t4: str = "", + t5: str = "", + t6: str = "", + **kwargs, + ): + r"""Defines a temperature table for material properties. + + Mechanical APDL Command: `MPTEMP `_ + + Parameters + ---------- + sloc : str + Starting location in table for entering temperatures. For example, if ``SLOC`` = 1, data input + in the ``T1`` field applies to the first constant in the table. If ``SLOC`` = 7, data input in + the ``T1`` field applies to the seventh constant in the table, etc. Defaults to the last + location filled + 1. + + t1 : str + Temperatures assigned to six locations starting with ``SLOC``. If a value is already in this + location, it will be redefined. A blank (or zero) value for ``T1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``T1``. Blank (or zero) values for + ``T2`` to ``T6`` leave the corresponding previous values unchanged. + + t2 : str + Temperatures assigned to six locations starting with ``SLOC``. If a value is already in this + location, it will be redefined. A blank (or zero) value for ``T1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``T1``. Blank (or zero) values for + ``T2`` to ``T6`` leave the corresponding previous values unchanged. + + t3 : str + Temperatures assigned to six locations starting with ``SLOC``. If a value is already in this + location, it will be redefined. A blank (or zero) value for ``T1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``T1``. Blank (or zero) values for + ``T2`` to ``T6`` leave the corresponding previous values unchanged. + + t4 : str + Temperatures assigned to six locations starting with ``SLOC``. If a value is already in this + location, it will be redefined. A blank (or zero) value for ``T1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``T1``. Blank (or zero) values for + ``T2`` to ``T6`` leave the corresponding previous values unchanged. + + t5 : str + Temperatures assigned to six locations starting with ``SLOC``. If a value is already in this + location, it will be redefined. A blank (or zero) value for ``T1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``T1``. Blank (or zero) values for + ``T2`` to ``T6`` leave the corresponding previous values unchanged. + + t6 : str + Temperatures assigned to six locations starting with ``SLOC``. If a value is already in this + location, it will be redefined. A blank (or zero) value for ``T1`` resets the previous value in + ``SLOC`` to zero. A value of zero can only be assigned by ``T1``. Blank (or zero) values for + ``T2`` to ``T6`` leave the corresponding previous values unchanged. + + Notes + ----- + + .. _MPTEMP_notes: + + Defines a temperature table to be associated with the property data table ( :ref:`mpdata` ). These + temperatures are also used for polynomial property evaluation, if defined ( :ref:`mp` ). + Temperatures must be defined in non-descending order. Issue :ref:`mater` $ :ref:`stat` to list the + current temperature table. Repeat :ref:`mptemp` command for additional temperatures (100 maximum). + If all arguments are blank, the temperature table is erased. + + For clear definition, the temperature range you define with the :ref:`mptemp` command should include + the entire range you'll use in subsequently defined materials. To assist the user in this, the first + (and only the first) excursion out of the temperature range defined by the :ref:`mptemp` commands is + flagged with a warning message. Similarly, the reference temperature ( :ref:`tref` or :ref:`mp` + ,REFT commands) should also fall in this same temperature range. If not and :ref:`mp`,ALPX was + used, a note will be output. If not, and :ref:`mp`,CTEX or :ref:`mp`,THSX was used, an error + message will be output. + + This command is also valid in SOLUTION. + """ + command = f"MPTEMP,{sloc},{t1},{t2},{t3},{t4},{t5},{t6}" + return self.run(command, **kwargs) + + def mptgen( + self, stloc: str = "", num: str = "", tstrt: str = "", tinc: str = "", **kwargs + ): + r"""Adds temperatures to the temperature table by generation. + + Mechanical APDL Command: `MPTGEN `_ + + Parameters + ---------- + stloc : str + Starting location in table for generating temperatures. Defaults to last location filled + 1. + + num : str + Number of temperatures to be generated (1-100). + + tstrt : str + Temperature assigned to ``STLOC`` location. + + tinc : str + Increment previous temperature by ``TINC`` and assign to next location until all ``NUM`` + locations are filled. + + Notes + ----- + + .. _MPTGEN_notes: + + Adds temperatures to the temperature table by generation. May be used in combination (or in place + of) the :ref:`mptemp` command. + + This command is also valid in SOLUTION. + """ + command = f"MPTGEN,{stloc},{num},{tstrt},{tinc}" + return self.run(command, **kwargs) + + def mptres(self, lab: str = "", mat: str = "", **kwargs): + r"""Restores a temperature table previously defined. + + Mechanical APDL Command: `MPTRES `_ + + Parameters + ---------- + lab : str + Material property label ( :ref:`mp` ). + + mat : str + Material reference number. + + Notes + ----- + + .. _MPTRES_notes: + + Restores into the database (from virtual space) a temperature table previously defined ( :ref:`mp` ) + for a particular property. The existing temperature table in the database is erased before this + operation. + + This command is also valid in SOLUTION. + """ + command = f"MPTRES,{lab},{mat}" + return self.run(command, **kwargs) + + def mpwrite( + self, fname: str = "", ext: str = "", lib: str = "", mat: str = "", **kwargs + ): + r"""Writes linear material properties in the database to a file (if the LIB option is not specified) or + writes both linear and nonlinear material properties (if LIB is specified) from the database to a + file. + + Mechanical APDL Command: `MPWRITE `_ + + Parameters + ---------- + fname : str + File name and directory path (248 characters maximum, including directory). If you do not + specify the ``LIB`` option, the default directory is the current working directory. If you + specify ``LIB`` and you have specified a material library directory (via the :ref:`mplib` + command), that directory is the default. Otherwise, the default is the current working + directory. If you use the default for your directory, you can use all 248 characters for the + file name. + + The file name defaults to :file:`Jobname`. + + ext : str + Filename extension (eight-character maximum). If you omit the ``LIB`` option, the default + extension is MP. If you specify the ``LIB`` option, the default extension is units_MPL, where + units is the system of units currently in use. (See the description of the :ref:`units` + command.) For example, if :ref:`units` is set to BIN, the extension defaults to BIN_MPL. + + lib : str + The only value allowed for this field is the string "LIB." + + The LIB option indicates that you wish to have properties associated with the material (MAT) + written to the specified material library file using the material library file format. The + material library file format is ASCII-text-based Mechanical APDL command input. Certain commands + associated with this format have been modified to interpret the string "_MATL" to mean the + currently selected material. This feature makes the material library file independent of the + material number in effect when the file was written; this enables you to restore the properties + into the Mechanical APDL database using the material number of your choice. The LIB option also + enables you to save both linear and nonlinear properties. If you omit the LIB option, you can + save linear properties only. + + mat : str + Specifies the material to be written to the named material library file. There is no default; + you must either specify a material or omit the ``MAT`` argument. Even if you specify a ``MAT`` + value, Mechanical APDL ignores it if the LIB argument is not specified. + + Notes + ----- + + .. _MPWRITE_notes: + + Writes linear material properties currently in the database to a file. The file is rewound before + and after writing. + + This command is also valid in SOLUTION. + """ + command = f"MPWRITE,{fname},{ext},,{lib},{mat}" + return self.run(command, **kwargs) + + def tbfplot( + self, + matid: str = "", + curvefitname: str = "", + expdatid: str = "", + colx: str = "", + coly1: str = "", + coly2: str = "", + **kwargs, + ): + r"""Plots `material curve-fitting + `_ data. + + Mechanical APDL Command: `TBFPLOT `_ + + Parameters + ---------- + matid : str + Material reference identification number. + + curvefitname : str + Material curve-fitting model name (obtainable via :ref:`tbft`,LIST). Enclose the name within + single quotes. + + expdatid : str + Experimental data ID. + + colx : str + Experimental data column to use in the X axis. + + coly1 : str + Experimental data column to use in the Y axis. + + coly2 : str + Fitted-data column to use in the Y axis. + + Notes + ----- + + .. _TBFPLOT_notes: + + This command plots the fitted data specified via ``ColY2`` (the number of experimental data columns + + 1) and the data specified via ``ColY1`` as a function of the X-axis data specified via ``ColX``. + + Issue this command after curve-fitting has been completed ( :ref:`tbft`,SOLVE). + + Material curve-fitting does not support saving to ( :ref:`save` ) and resuming from ( :ref:`resume` + ) the database file. You must therefore rerun the curve-fitting analysis, then issue :ref:`tbfplot` + again to replot. + """ + command = f"TBFPLOT,{matid},{curvefitname},{expdatid},{colx},{coly1},{coly2}" + return self.run(command, **kwargs) + + def tbft( + self, + oper: str = "", + matid: str = "", + option1: str = "", + option2: str = "", + option3: str = "", + option4: str = "", + option5: str = "", + option6: str = "", + option7: str = "", + option10: str = "", + **kwargs, + ): + r"""Performs `material curve-fitting + `_ operations. + + Mechanical APDL Command: `TBFT `_ + + Parameters + ---------- + oper : str + The operation to perform: + + * ``Operation Set 1 (Curve-Fitting)`` - - - - - - - - - - - - - - - - - - - - - + + * ``FADD`` - Define a constitutive model. + + * ``FDEL`` - Delete a constitutive model. + + * ``FSET`` - Write data related to a constitutive model to the database (same as :ref:`tb` command). + + * ``SET`` - Initialize coefficients of a constitutive model for nonlinear curve-fitting procedure. + + * ``CDEL`` - Deletes coefficients at current reference temperature. Applicable only for temperature- + dependent coefficients. + + * ``AINI`` - Automatically initialize coefficients based on elastic properties and experimental + data. + + * ``SOLVE`` - Solve for coefficients. + + * ``PSOLVE`` - Custom multistep solve for coefficients. + + * ``FIX`` - Fix (hold constant) the coefficient you specify in ``Option4``. + + * ``Operation Set 2 (Experimental Data)`` - - - - - - - - - - - - - - - - - - - - - + + * ``EADD`` - Add experimental data. + + * ``EDEL`` - Delete experimental data. + + * ``Other Operations`` - - - - - - - - - - - - - - - - - - - - - + + * ``LIST`` - List all data associated with the material model represented by the material ID number + ( ``MATID`` ). + + matid : str + Material reference identification number. (Same as :ref:`tb`, ``MATID``.) Valid value is any + number ``n``, where 0 < ``n`` < 100,000. Default = 1. + + option1 : str + AML - For curve-fitting function operations ( ``Oper`` = Operation Set 1), this value specifies + the category. + + UNIA - For adding or deleting your experiment (Operation Set 2), this value specifies the + experimental data type. + + option2 : str + For curve-fitting function operations ( ``Oper`` = Operation Set 1), this value specifies the + constitutive model type. The only valid value is GENR (generic). + + To obtain experimental data ( ``Oper`` = EADD in Operation Set 2) from a file, specify any valid + file name. (You can either specify the entire ``path`` \ ``filename`` . ``extension`` string + here and leave ``Option3`` and ``Option4`` blank, or specify ``filename`` here, ``extension`` in + ``Option3``, and ``path`` in ``Option4``.) + + option3 : str + For curve-fitting function operations ( ``Oper`` = Operation Set 1), specify a unique name for + your curve-fitting model. + + For obtaining experimental data ( Oper = EADD in Operation Set 2) from a file specified in + Option2, specify the file extension. + + option4 : str + When fixing a specific coefficient to a desired value ( ``Oper`` = FIX), this value specifies + the index of that coefficient. Valid values vary from 1 to ``n``, where ``n`` is the total + number of coefficients. Default = 1. + + For ``Oper`` = SET, see :ref:`tmftableoperset`. + + You can also specify ``TREF`` to indicate the reference temperature, or ``COMP`` for a + partial/complete solution (only for bulk, only for shear, or all coefficients). + + If ``Oper`` = SOLVE, this value specifies the curve-fitting procedure. Valid values are 0 for + non- normalized least squares curve-fitting procedure, and 1 for normalized least squares curve- + fitting procedure. + + For obtaining experimental data ( Oper = EADD) from a file specified in Option2, specify the + path in which the file resides. + + option5 : str + For ``Oper`` = SET, refer to the following table: + + .. _tmftableoperset: + + Set Operations + ************** + + .. flat-table:: + :header-rows: 1 + + * - Purpose + - Option4 + - Option5 + * - Set the value of the coefficient + - Index of coefficient + - Value of coefficient + * - Set temperature dependency ON/OFF + - TDEP + - 1 -- ON 0 -- OFF + * - Set reference temperature + - TREF + - Temperature value + + If ``Oper`` = SOLVE, use this value to specify the number of iterations to be used in the + calculation of the coefficients. Valid value is any positive integer. Default = 1000. + + If you are specifying a coefficient to be held constant ( ``Oper`` = FIX): + + * 1 - Fix the specified coefficient. + * 0 - Allow the specified coefficient to vary (disable fixing). + + option6 : str + If ``Oper`` = SOLVE, specify the allowed tolerance in residual change to stop an iteration. + Valid value is 0.0 to 1.0. Default = 0.0. + + option7 : str + If ``Oper`` = SOLVE, specify the allowed tolerance in coefficient change to stop an iteration. + Valid value is 0 to 1. Default = 0. + + option10 : str + If ``Oper`` = SOLVE, enables parameter scaling when set to 1. Default = 0. Used for creep + material curve-fitting. + + Notes + ----- + + .. warning:: + + This function contains specificities regarding the argument definitions. + Please refer to the `command documentation `_ + for further explanations. + + *\*TBFT Specifications for Hyperelastic Models** + + .. _TBFThypspec: + + :ref:`tbft`, ``Oper``, ``MATID``, ``Option1``, ``Option2``, ``Option3``, ``Option4``, ``Option5``, + ``Option6``, ``Option7`` + + * ``Oper`` - The operation to perform: + + * ``Operation Set 1 (Curve-Fitting)`` - - - - - - - - - - - - - - - - - - - - - + + * ``FADD`` - Define a constitutive model for parameter fitting and import all parameters (defined + previously via :ref:`tb` and :ref:`tbdata` ). + + * ``FDEL`` - Delete a constitutive model. + + * ``FSET`` - Write data related to a constitutive model to the database (same as :ref:`tb` command). + + * ``SET`` - Initialize coefficients of a constitutive model for nonlinear curve-fitting procedure. + + * ``CDEL`` - Deletes coefficients at current reference temperature. Applicable only for temperature + dependent coefficients. + + * ``SOLVE`` - Solve for coefficients. + + * ``FIX`` - Fix (hold constant) the coefficient you specify in ``Option4``. + + * ``Operation Set 2 (Experimental Data)`` - - - - - - - - - - - - - - - - - - - - - + + * ``EADD`` - Add experimental data. + + * ``EDEL`` - Delete experimental data. + + * ``Other Operations`` - - - - - - - - - - - - - - - - - - - - - + + * ``LIST`` - List all data associated with the material model represented by the material ID number + ( ``MATID`` ) + + * ``MATID`` - Material reference identification number (same as ``MAT`` argument used in the + :ref:`tb` command). Valid value is any number ``n``, where 0 < ``n`` < 100,000. Default = 1. + + * ``Option1`` - For curve-fit function operations ( ``Oper`` = FADD, FDEL, FSET, SET, CDEL, SOLVE or + FIX) this value + specifies the category (AML). + + For adding or deleting your experiment ( ``Oper`` = EADD or EDEL), this value specifies the experimental data type. **Valid options:** UNIA (default), BIAX, SHEA, SSHE,and VOLU. + + * ``Option2`` - For curve-fit function operations ( ``Oper`` = FADD, FDEL, FSET, SET, CDEL, SOLVE, + or FIX), set this value to GENR. + + When you need to specify a file name from which to get experimental data ( ``Oper`` = EADD), place + that string here. Valid value is any file name string. You can enter the entire + :file:`path\filename.extension` string and leave the next two values ( ``Option3`` and ``Option4`` ) + blank, or you can specify the name here, the extension in the next value, and the path following. + + * ``Option3`` - For ``Oper`` = FADD, FDEL, FSET, CDEL, SET, SOLVE or FIX, set this value to a user- + defined name (to be used consistently in the curve-fitting process). + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value will contain the file extension. + + * ``Option4`` - When you are working on a specific coefficient ( ``Oper`` = FIX), this value + specifies the index of that coefficient. Valid values vary from 1 to ``n``, where ``n`` is the total + number of coefficients. Default = 1. + + For ``Oper`` = SET, see :ref:`tbfthypsetvals`, below. + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value will contain the directory/path specification. + + If ``Oper`` = SOLVE, this value specifies the curve-fitting procedure. Valid values are 0 for non- + normalized least squares curve-fitting procedure, and 1 for normalized least squares curve-fitting + procedure. + + * ``Option5`` - When you are working on a specific coefficient ( ``Oper`` = FIX), this value + specifies the index of + that coefficient. Valid values vary from 1 to N, where N is the total number of coefficients. + Default = 1. + + For ``Oper`` = SET, see :ref:`tbfthypsetvals`, below. + + .. _tbfthypsetvals: + + Set Operations + ************** + + .. flat-table:: + :header-rows: 1 + + * - Purpose + - Option4 + - Option5 + * - Set the value of the coefficient. + - Index of coefficient + - Value of that coefficient + * - Set temperature dependency ON/OFF Specify temperature data in the same specified via :ref:`tref`. + - TDEP + - 1 -- ON 0 -- OFF + * - Set reference temperature + - TREF + - Temperature value + + If ``Oper`` = SOLVE, use this value to specify the number of iterations to be used in the + calculation of the coefficients. Valid value is any positive integer. Default = 1000. + + * ``Option6`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in residual change to stop an + iteration. Valid value is 0.0 to 1.0. Default = 0.0. + + * ``Option7`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in coefficient change to stop + an iteration. Valid value is 0 to 1. Default = 0. + + For the supported list of material models, see. + + This table summarizes the format for hyperelastic curve-fitting operations via :ref:`tbft` : + + Hyperelastic Model Command Summary + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + *\*TBFT Specifications for Viscoelastic Models** + + .. _TBFTviscspec: + + :ref:`tbft`, ``Oper``, ``MATID``, ``Option1``, ``Option2``, ``Option3``, ``Option4``, ``Option5``, + ``Option6``, ``Option7`` + + * ``Oper`` - The operation to perform: + + * ``Operation Set 1 (Curve-Fitting)`` - - - - - - - - - - - - - - - - - - - - - + + * ``FADD`` - Define a constitutive model. + + * ``FDEL`` - Delete a constitutive model. + + * ``FSET`` - Write data related to a constitutive model to the database (same as :ref:`tb` command). + + * ``SET`` - Initialize coefficients of a constitutive model for nonlinear curve-fitting procedure. + + * ``CDEL`` - Deletes coefficients at current reference temperature. Applicable only for temperature + dependent coefficients. + + * ``SOLVE`` - Solve for coefficients. + + * ``FIX`` - Fix (hold constant) the coefficient you specify in ``Option4``. + + * ``Operation Set 2 (Experimental Data)`` - - - - - - - - - - - - - - - - - - - - - + + * ``EADD`` - Add experimental data. + + * ``EDEL`` - Delete experimental data. + + * ``Other Operations`` - - - - - - - - - - - - - - - - - - - - - + + * ``LIST`` - List all data associated with the material model represented by the material ID number + ( ``MATID`` ) + + * ``MATID`` - Material reference identification number (same as ``MAT`` argument used in the + :ref:`tb` command). Valid value is any number ``n``, where 0 < ``n`` < 100,000. Default = 1. + + * ``Option1`` - For curve-fitting function operations ( ``Oper`` = FADD, FDEL, FSET, SET, CDEL, + SOLVE, or FIX), this + value is set to AML. + + For adding or deleting your experiment ( ``Oper`` = EADD or EDEL), this value specifies the experiment type. **Valid options:** SDEC (Shear Modulus vs. Time/Freq) or BDEC (Bulk Modulus vs. Time/Freq). + + * ``Option2`` - For curve-fitting function operations ( ``Oper`` = FADD, FDEL, FSET, SET, CDEL, + SOLVE, or FIX), this value is set to GENR. + + When you need to specify a file name from which to get experimental data ( ``Oper`` = EADD), place + that string here. Valid value is any file name string. You can enter the entire + :file:`path\filename.extension` string and leave the next two values ( ``Option3`` and ``Option4`` ) + blank, or you can specify the name here, the extension in the next value, and the path following. + + * ``Option3`` - For ``Oper`` = FADD, FDEL, FSET, CDEL, SET, SOLVE, or FIX, set this value to any + user-defined name (to be used consistently during the curve-fitting process). + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value will contain the file extension. + + * ``Option4`` - When you are working on a specific coefficient ( ``Oper`` = FIX), this value + specifies the index of that coefficient. Valid values vary from 1 to ``n``, where ``n`` is the total + number of coefficients. Default = 1. + + For ``Oper`` = SET, see :ref:`tbftvscsetvals` below. + + You can also specify ``TREF`` to indicate the reference temperature. + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value will contain the directory/path specification. + + If ``Oper`` = SOLVE, this value specifies the curve-fitting procedure. Valid values are 0 for non- + normalized least squares curve-fitting procedure, and 1 for normalized least squares curve-fitting + procedure. + + * ``Option5`` - For ``Oper`` = SET, see :ref:`tbftvscsetvals` below. + + .. _tbftvscsetvals: + + Set Operations + ************** + + .. flat-table:: + :header-rows: 1 + + * - Purpose + - Option4 + - Option5 + * - Set the value of the coefficient + - Index of coefficient + - Value of coefficient + * - Set temperature dependency ON/OFF + - TDEP + - 1 for ON and 0 for OFF + * - Set reference temperature + - TREF + - Temperature value + + If ``Oper`` = SOLVE, use this value to specify the number of iterations to be used in the + calculation of the coefficients. Valid value is any positive integer. Default = 1000. + + If you are specifying a coefficient to be held constant ( ``Oper`` = FIX): + + * 1 - Fix the specified coefficient. + * 0 - Allow the specified coefficient to vary (disable fixing). + + * ``Option6`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in residual change to stop an + iteration. Valid value is 0.0 to 1.0. Default = 0.0. + + * ``Option7`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in coefficient change to stop + an iteration. Valid value is 0 to 1. Default = 0. + + This table summarizes the format for viscoelastic curve-fitting operations via :ref:`tbft` : + + Viscoelastic Model Command Summary + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + *\*TBFT Specifications for Chaboche Kinematic Hardening Plasticity Models** + + .. _TBFTchabspec: + + :ref:`tbft`, ``Oper``, ``MATID``, ``Option1``, ``Option2``, ``Option3``, ``Option4``, ``Option5``, + ``Option6``, ``Option7``, -, -, ``Option10`` + + * ``Oper`` - The operation to perform: + + * ``Operation Set 1 (Curve-Fitting)`` - - - - - - - - - - - - - - - - - - - - - + + * ``FCASE`` - Define a case/constitutive model for plasticity. + + * ``FADD`` - Define a constitutive model. + + * ``FDEL`` - Delete a constitutive model. + + * ``FSET`` - Write data related to a constitutive model to the database (same as :ref:`tb` command). + + * ``SET`` - Initialize coefficients of a constitutive model for nonlinear curve-fitting procedure. + + * ``CDEL`` - Deletes coefficients at current reference temperature. Applicable only for temperature- + dependent coefficients. + + * ``SOLVE`` - Solve for coefficients. + + * ``FIX`` - Fix (hold constant) the coefficient you specify in ``Option4``. + + * ``Operation Set 2 (Experimental Data)`` - - - - - - - - - - - - - - - - - - - - - + + * ``EADD`` - Add experimental data. + + * ``EDEL`` - Delete experimental data. + + * ``Other Operations`` - - - - - - - - - - - - - - - - - - - - - + + * ``LIST`` - List all data associated with the material model represented by the material ID number + ( ``MATID`` ). + + * ``MATID`` - Material reference identification number (same as ``MAT`` argument used in the + :ref:`tb` command). Valid value is any number greater than zero (default = 1) but less than 100,000. + + * ``Option1`` - For ``Oper`` = FCASE, set to either NEW or FINI. The command :ref:`tbft`,FCASE, + ``MATID``,NEW initializes a new curve-fitting case. (The :ref:`tbft`,FADD commands described next + are always issued between :ref:`tbft`,FCASE, ``MATID``,NEW and :ref:`tbft`,FCASE, ``MATID``,FINI + commands.) After issuing :ref:`tbft`,FCASE, ``MATID``,FINI, the Chaboche model is created and is + ready to be used to perform other curve-fitting operations. For more information, see `Material + Curve-Fitting `_ + + For ``Oper`` = FADD, set to PLAS to add options/parameters for the new case being created (via + :ref:`tbft`,FCASE, ``MATID``,NEW, which must be issued before the :ref:`tbft`,FADD command). This + operation specifies the order of the Chaboche kinematic model. + + For other curve-fitting function operations ( ``Oper`` = FDEL, FSET, SET, CDEL, SOLVE or FIX), set + to CASE. + + For adding or deleting your experiment ( ``Oper`` = EADD or EDEL), this option specifies the + experiment type. The only valid option is UNIA (plastic strain vs. true stress). + + * ``Option2`` - For ``Oper`` = FCASE (defining your Chaboche case), set to CPLA. + + For ``Oper`` = FDEL, FSET, SET, CDEL, SOLVE, or FIX (curve-fitting function operations), this value + specifies the case name being operated on. + + For ``Oper`` = FADD (specifying options for the plasticity model), valid options are: + + * CHAB -- Chaboche kinematic hardening (required for any defined curve-fitting case) + * BISO -- Bilinear isotropic hardening (optional) + * MISO -- Multilinear isotropic hardening (optional) + * VOCE -- Nonlinear isotropic hardening, Voce model (optional) + * The :ref:`tbft`,FADD command can be issued twice, once to specify the order of the Chaboche model, + and again to specify the isotropic hardening option. (Only one of the options BISO, MISO or VOCE + can be used in a single curve-fitting case, and none of those options are required.) + + For ``Oper`` = EADD (specifying a file name from which to get experimental data), place that string + here. A valid entry is any file name string. You can either: + + * Enter the entire :file:`path\filename.extension` string and leave the next two values ( + ``Option3`` and ``Option4`` ) blank, or + + * Specify the name here, the extension in the next value, and the path in the following value. + + * ``Option3`` - For ``Oper`` = FCASE, this value specifies the case name. + + For ``Oper`` = FADD, this value specifies either: + + * The order of the Chaboche kinematic hardening model ( ``Option2`` = CHAB), or + + * The number of terms in the MISO model ( ``Option2`` = MISO). + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value contains the file extension. + + * ``Option4`` - When fixing a specific coefficient to a desired value ( ``Oper`` = FIX), this value + specifies the index of that coefficient. Valid values vary from 1 to ``n``, where ``n`` is the total + number of coefficients. Default = 1. + + For ``Oper`` = SET, see :ref:`tbftvscsetvals`. + + You can also specify ``TREF`` to indicate the reference temperature, or ``COMP`` for a + partial/complete solution (only for bulk, only for shear, or all coefficients). + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value contains the directory/path specification. + + If ``Oper`` = SOLVE, this value specifies the normalized/non-normalized option. This option is not + available for Chaboche curve-fitting. + + * ``Option5`` - For ``Oper`` = SET, refer to the following table. + + .. _tbftchabsetvals: + + Set Operations + ************** + + .. flat-table:: + :header-rows: 1 + + * - Purpose + - Option4 + - Option5 + * - Set the value of the coefficient + - Index of coefficient + - Value of coefficient + * - Set temperature dependency ON/OFF + - TDEP + - 1 for ON and 0 for OFF + * - Set reference temperature + - TREF + - Temperature value + + If ``Oper`` = SOLVE, use this value to specify the number of iterations to be used in the + calculation of the coefficients. Valid value is any positive integer. Default = 1000. + + If you are specifying a coefficient to be held constant ( ``Oper`` = FIX): + + * 1 - Fix the specified coefficient. + * 0 - Allow the specified coefficient to vary (disable fixing). + + * ``Option6`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in residual change to stop an + iteration. Valid value is 0.0 to 1.0. Default = 0.0. + + * ``Option7`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in coefficient change to stop + an iteration. Valid value is 0 to 1. Default = 0. + + * ``-`` - Reserved for future use. + + * ``-`` - Reserved for future use. + + * ``Option10`` - If ``Oper`` = SOLVE, enables parameter scaling when set to 1. Default = 0. Used for + Chaboche material curve-fitting. + + This table summarizes the format for Chaboche curve-fitting operations via :ref:`tbft` : + + Chaboche Model Command Summary + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + *\*TBFT Specifications for Creep Models** + + .. _TBFTcreepspec: + + :ref:`tbft`, ``Oper``, ``MATID``, ``Option1``, ``Option2``, ``Option3``, ``Option4``, ``Option5``, + ``Option6``, ``Option7``, -, -, ``Option10`` + + * ``Oper`` - The operation to perform: + + * ``Operation Set 1 (Curve-Fitting)`` - - - - - - - - - - - - - - - - - - - - - + + * ``FADD`` - Define a constitutive model. + + * ``FDEL`` - Delete a constitutive model. + + * ``FSET`` - Write data related to a constitutive model to the database (same as :ref:`tb` command). + + * ``SET`` - Initialize coefficients of a constitutive model for nonlinear curve-fitting procedure. + + * ``CDEL`` - Deletes coefficients at current reference temperature. Applicable only for temperature + dependent coefficients. + + * ``SOLVE`` - Solve for coefficients. + + * ``FIX`` - Fix (hold constant) the coefficient you specify in ``Option4``. + + * ``Operation Set 2 (Experimental Data)`` - - - - - - - - - - - - - - - - - - - - - + + * ``EADD`` - Add experimental data. + + * ``EDEL`` - Delete experimental data. + + * ``Other Operations`` - - - - - - - - - - - - - - - - - - - - - + + * ``LIST`` - List all data associated with the material model represented by the material ID number + ( ``MATID`` ) + + * ``MATID`` - Material reference identification number (same as ``MAT`` argument used in the + :ref:`tb` command). Valid value is any number ``n``, where 0 < ``n`` < 100,000. Default = 1. + + * ``Option1`` - For curve-fit function operations ( ``Oper`` = FADD, FDEL, FSET, SET, CDEL, SOLVE or + FIX) this value specifies the category (CREEP). + + For adding or deleting your experiment ( ``Oper`` = EADD or EDEL), this value specifies the + experimental data type (CREEP). + + * ``Option2`` - For curve-fit function operations ( ``Oper`` = FADD, FDEL, FSET, SET, CDEL, SOLVE, + or FIX), this value specifies constitutive model type. The valid values are listed in + :ref:`tbftcreepoption` below. + + When you need to specify a file name from which to get experimental data ( ``Oper`` = EADD), place + that string here. Valid value is any file name string. You can enter the entire + :file:`path\filename.extension` string and leave the next two values ( ``Option3`` and ``Option4`` ) + blank, or you can specify the name here, the extension in the next value, and the path following. + + * ``Option3`` - If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = + EADD), this value will contain the file extension. + + * ``Option4`` - When you are working on a specific coefficient ( ``Oper`` = FIX), this value, + specifies the index of that coefficient. Valid values vary from 1 to ``n``, where ``n`` is the total + number of coefficients. Default = 1. + + For ``Oper`` = SET, see :ref:`tbftcrpsetvals`, below. + + If a file name for experimental data is being specified in ``Option2`` ( ``Oper`` = EADD), this + value will contain the directory/path specification. + + If ``Oper`` = SOLVE, this value specifies the curve-fitting procedure. Valid values are 0 for non- + normalized least squares curve-fitting procedure, and 1 for normalized least squares curve-fitting + procedure. + + * ``Option5`` - If ``Oper`` = SOLVE, use this value to specify the number of iterations to be used + in the + calculation of the coefficients. Valid value is any positive integer. Default = 1000. + + If you are specifying a coefficient to be held constant ( ``Oper`` = FIX): + + * 1 - Fix the specified coefficient. + * 0 - Allow the specified coefficient to vary (disable fixing). + + For ``Oper`` = SET, see :ref:`tbftcrpsetvals`, below. + + .. _tbftcrpsetvals: + + Set Operations + ************** + + .. flat-table:: + :header-rows: 1 + + * - Purpose + - Option4 + - Option5 + * - Set the value of the coefficient + - Index of coefficient + - Value of coefficient + * - Set temperature dependency ON When TDEP is OFF, the Arrhenius term (C4) in the strain-hardening creep equation is calculated. Because :ref:`tbtemp` is not included in the curve-fitting, the experimental data (in absolute temperature) must be provided via ``/TEMP``. /OFF When TDEP is ON, the Arrhenius term is set to 0 and the constants are calculated separately for each temperature. The curve-fitting process uses :ref:`tbtemp`. You must provide the experimental data using the same units as specified via :ref:`tref`. + - TDEP + - 1 -- ON 0 -- OFF + * - Set reference temperature + - TREF + - Temperature value + + * ``Option6`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in residual change to stop an + iteration. Valid value is 0.0 to 1.0. Default = 0.0. + + * ``Option7`` - If ``Oper`` = SOLVE, specifies the allowed tolerance in coefficient change to stop + an iteration. Valid value is 0 to 1. Default = 0. + + * ``-`` - Reserved for future use. + + * ``-`` - Reserved for future use. + + * ``Option10`` - If ``Oper`` = SOLVE, enables parameter scaling when set to 1. Default = 0. Used for + creep material curve-fitting. + + .. _tbftcreepoption: + + Creep Options + ************* + + .. flat-table:: + :header-rows: 1 + + * - Category + - Name + - Option + * - CREEP + - SHAR + - NA + * - CREEP + - THAR + - NA + * - CREEP + - GEXP + - NA + * - CREEP + - GGRA + - NA + * - CREEP + - GBLA + - NA + * - CREEP + - MTHA + - NA + * - CREEP + - MSHA + - NA + * - CREEP + - GGAR + - NA + * - CREEP + - EXPO + - NA + * - CREEP + - NORT + - NA + * - CREEP + - PSTH + - NA + * - CREEP + - PSRP + - NA + * - CREEP + - GTHA + - NA + + This table summarizes the format for creep curve-fitting operations via :ref:`tbft` : + + Creep Model Command Summary + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + *\*TBFT Specifications for Thermomechanical Fatigue (TMF)and Plasticity Model Combinations** + + .. _TBFTtmfspec: + + :ref:`tbft`, ``Oper``, ``MATID``, ``Option1``, ``Option2``, ``Option3``, ``Option4``, ``Option5``, + ``Option6``, ``Option7`` + + * ``Oper`` - The operation to perform: + + * ``Operation Set 1 (Curve-Fitting)`` - - - - - - - - - - - - - - - - - - - - - + + * ``FADD`` - Define a constitutive model. + + * ``FDEL`` - Delete a constitutive model. + + * ``FSET`` - Write data related to a constitutive model to the database (same as :ref:`tb` command). + + * ``SET`` - Initialize coefficients of a constitutive model for nonlinear curve-fitting procedure. + + * ``CDEL`` - Deletes coefficients at current reference temperature. Applicable only for temperature- + dependent coefficients. + + * ``AINI`` - Automatically initialize coefficients based on elastic properties and experimental + data. + + * ``SOLVE`` - Solve for coefficients. + + * ``PSOLVE`` - Custom multistep solve for coefficients. + + * ``FIX`` - Fix (hold constant) the coefficient you specify in ``Option4``. + + * ``Operation Set 2 (Experimental Data)`` - - - - - - - - - - - - - - - - - - - - - + + * ``EADD`` - Add experimental data. + + * ``EDEL`` - Delete experimental data. + + * ``Other Operations`` - - - - - - - - - - - - - - - - - - - - - + + * ``LIST`` - List all data associated with the material model represented by the material ID number + ( ``MATID`` ). + + * ``MATID`` - Material reference identification number. (Same as :ref:`tb`, ``MATID``.) Valid value + is any number ``n``, where 0 < ``n`` < 100,000. Default = 1. + + * ``Option1`` - AML - For curve-fitting function operations ( ``Oper`` = Operation Set 1), this + value specifies the category. + + UNIA - For adding or deleting your experiment (Operation Set 2), this value specifies the + experimental data type. + + * ``Option2`` - For curve-fitting function operations ( ``Oper`` = Operation Set 1), this value + specifies the constitutive model type. The only valid value is GENR (generic). + + To obtain experimental data ( ``Oper`` = EADD in Operation Set 2) from a file, specify any valid + file name. (You can either specify the entire ``path`` \ ``filename`` . ``extension`` string here + and leave ``Option3`` and ``Option4`` blank, or specify ``filename`` here, ``extension`` in + ``Option3``, and ``path`` in ``Option4``.) + + * ``Option3`` - For curve-fitting function operations ( ``Oper`` = Operation Set 1), specify a + unique name for your curve-fitting model. + + For obtaining experimental data ( Oper = EADD in Operation Set 2) from a file specified in Option2, + specify the file extension. + + * ``Option4`` - When fixing a specific coefficient to a desired value ( ``Oper`` = FIX), this value + specifies the index of that coefficient. Valid values vary from 1 to ``n``, where ``n`` is the total + number of coefficients. Default = 1. + + For ``Oper`` = SET, see :ref:`tmftableoperset`. + + You can also specify ``TREF`` to indicate the reference temperature, or ``COMP`` for a + partial/complete solution (only for bulk, only for shear, or all coefficients). + + If ``Oper`` = SOLVE, this value specifies the curve-fitting procedure. Valid values are 0 for non- + normalized least squares curve-fitting procedure, and 1 for normalized least squares curve-fitting + procedure. + + For obtaining experimental data ( Oper = EADD) from a file specified in Option2, specify the path in + which the file resides. + + * ``Option5`` - For ``Oper`` = SET, refer to the following table: + + .. _tmftableoperset: + + Set Operations + ************** + + .. flat-table:: + :header-rows: 1 + + * - Purpose + - Option4 + - Option5 + * - Set the value of the coefficient + - Index of coefficient + - Value of coefficient + * - Set temperature dependency ON/OFF + - TDEP + - 1 -- ON 0 -- OFF + * - Set reference temperature + - TREF + - Temperature value + + If ``Oper`` = SOLVE, use this value to specify the number of iterations to be used in the + calculation of the coefficients. Valid value is any positive integer. Default = 1000. + + If you are specifying a coefficient to be held constant ( ``Oper`` = FIX): + + * 1 - Fix the specified coefficient. + * 0 - Allow the specified coefficient to vary (disable fixing). + + * ``Option6`` - If ``Oper`` = SOLVE, specify the allowed tolerance in residual change to stop an + iteration. Valid value is 0.0 to 1.0. Default = 0.0. + + * ``Option7`` - If ``Oper`` = SOLVE, specify the allowed tolerance in coefficient change to stop an + iteration. Valid value is 0 to 1. Default = 0. + + Supported Material Models + ^^^^^^^^^^^^^^^^^^^^^^^^^ + + This command contains some tables and extra information which can be inspected in the original + documentation pointed above. + + .. _TBFT_notes: + + The :ref:`tbft` command provides tools for comparing experimental material data to the program- + provided calculated data for various nonlinear material options. Based on curve-fitting comparisons + and error norms, choose the model to use during the solution phase of the analysis according to the + best fit. All of the capabilities of the :ref:`tbft` command are accessible interactively via the + standard material GUI. For more information, see `Material Curve-Fitting + `_ + + Display material model data associated with both the :ref:`tb` command and the :ref:`tbft`,FSET + command via :ref:`tblist`,ALL,ALL. + + Material model data associated with the most recent :ref:`tb` or :ref:`tbft`,FSET command + overwrites previous data. + + Display material model data associated with both the :ref:`tb` command and the :ref:`tbft`,FSET + command via :ref:`tblist`,ALL,ALL. + + The capability to fix coefficients ( ``Option4`` = FIX) applies only to nonlinear curve fitting (as + listed in. + + The uniaxial, biaxial, and shear experimental data use engineering stress. The volumetric data uses + true stress. See the `Material Reference + `_ for details + about experimental data for creep and viscoelasticity. + + The hyperelastic option AML,GENR is a generalized framework where the parameters (defined prior to + issuing :ref:`tbft` ) are imported directly from :ref:`tb` and :ref:`tbdata`. Parameter-fitting uses + this framework for the `thermomechanical fatigue + `_, + `geomechanical + `_, and + `TNM + `_ + material models. + + :ref:`tbft` does not support saving to ( :ref:`save` ) and resuming from ( :ref:`resume` ) the + database file. You must therefore rerun the curve-fitting analysis and then replot ( :ref:`tbfplot` + ). + """ + command = f"TBFT,{oper},{matid},{option1},{option2},{option3},{option4},{option5},{option6},{option7},,,{option10}" + return self.run(command, **kwargs) + + def uimp( + self, + mat: str = "", + lab1: str = "", + lab2: str = "", + lab3: str = "", + val1: str = "", + val2: str = "", + val3: str = "", + **kwargs, + ): + r"""Defines constant material properties (GUI). + + Mechanical APDL Command: `UIMP `_ + + Parameters + ---------- + mat : str + Material number. + + lab1 : str + Material property labels (see :ref:`mp` for valid labels). + + lab2 : str + Material property labels (see :ref:`mp` for valid labels). + + lab3 : str + Material property labels (see :ref:`mp` for valid labels). + + val1 : str + Values corresponding to three labels. + + val2 : str + Values corresponding to three labels. + + val3 : str + Values corresponding to three labels. + + Notes + ----- + + .. _UIMP_notes: + + :ref:`uimp` is generated by the Graphical User Interface (GUI) and appears in the log file ( + :file:`Jobname.LOG` ) if material properties are specified via the Material Properties dialog. The + command is not intended to be typed in directly during an analysis (although it can be included in + an input file for batch input or for use with :ref:`input` ). + """ + command = f"UIMP,{mat},{lab1},{lab2},{lab3},{val1},{val2},{val3}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/prep7/meshing.py b/src/ansys/mapdl/core/_commands/prep7/meshing.py index d0c9a0a904a..66f1b32cd15 100644 --- a/src/ansys/mapdl/core/_commands/prep7/meshing.py +++ b/src/ansys/mapdl/core/_commands/prep7/meshing.py @@ -131,7 +131,7 @@ def accat(self, na1: str = "", na2: str = "", **kwargs): You can use the :ref:`asel` command to select areas that were created by concatenation, and then follow it with an :ref:`adele`,ALL command to delete them. See `Meshing Your Solid Model `_ - in the `Modeling and Meshing Guide + in the `Modeling and Meshing Guide `_ for a discussion on how to easily select and delete concatenated areas in one step. @@ -263,7 +263,7 @@ def amap( Only one area at a time can be meshed with this command. The program internally concatenates all lines between the specified keypoints, then meshes the area with all quadrilateral elements. If line - divisions are set, the mesh will follow the rules for mapped meshing (see `Meshing Your Solid + divisions are set, the mesh will follow the rules for mapped meshing (see `Meshing Your Solid Model `_ in the `Modeling and Meshing Guide @@ -314,7 +314,7 @@ def amesh(self, na1: str = "", na2: str = "", ninc: str = "", **kwargs): Any undefined nodes required for the generated elements are created and assigned the lowest available numbers. - This command is also valid fo r `rezoning + This command is also valid fo r `rezoning `_. """ command = f"AMESH,{na1},{na2},{ninc}" @@ -393,7 +393,7 @@ def arefine( .. _AREFINE_notes: :ref:`arefine` performs local mesh refinement around the specified areas. By default, the indi - cated elements are split to create new elements with 1/2 the edge length of the original + cated elements are split to create new elements with 1/2 the edge length of the original elements ( ``LEVEL`` = 1). :ref:`arefine` refines all area elements and tetrahedral volume elements that are adjacent to the @@ -995,7 +995,7 @@ def esys(self, kcn: int | str = "", **kwargs): onto the shell or layer plane to determine the element coordinate system. See `Understanding the Element Coordinate System `_ - for more details. N refers to the coordinate system reference number ( ``KCN`` ) defined + for more details. N refers to the coordinate system reference number ( ``KCN`` ) defined using the :ref:`local` (or similar) command. Element coordinate system numbers may be displayed( :ref:`pnum` ). """ @@ -1091,7 +1091,7 @@ def gsgdata( The ending point is automatically determined from the starting (reference) point and the geometry inputs. All inputs are in the global Cartesian coordinate system. For more information about the generalized plane strain feature, see Generalized Plane Strain Option of Current-Technology Solid - Elements in the `Element Reference + Elements in the `Element Reference `_. """ command = f"GSGDATA,{lfiber},{xref},{yref},{rotx0},{roty0}" @@ -1435,7 +1435,7 @@ def krefine( of commands), or boundary conditions or loads applied directly to any of its nodes or elements. This applies to nodes and elements anywhere in the model, not just in the region where you want to request mesh refinement. See `Revising Your Model - `_ in the + `_ in the `Modeling and Meshing Guide `_ for additional restrictions on mesh refinement. @@ -1645,7 +1645,7 @@ def lccat(self, nl1: str = "", nl2: str = "", **kwargs): You can use the :ref:`lsel` command to select lines that were created by concatenation, and then follow it with an :ref:`ldele`,ALL command to delete them. Also see `Meshing Your Solid Model - `_ in the + `_ in the `Modeling and Meshing Guide `_ for a discussion on how to easily select and delete concatenated lines in one step. @@ -2330,7 +2330,7 @@ def mshcopy( Matching meshes are used for rotational (cyclic) symmetry, or for contact analysis using coupling or node-to-node gap elements. See `Using CPCYC and MSHCOPY Commands - `_ in + `_ in the `Modeling and Meshing Guide `_ for more information. @@ -3481,7 +3481,7 @@ def vatt( In some cases, the program can proceed with a volume meshing operation even when no logical element type has been assigned via :ref:`vatt`, ``TYPE`` or :ref:`type`. For more information, see the discussion on setting element attributes in `Meshing Your Solid Model - `_ of the + `_ of the `Modeling and Meshing Guide `_. """ @@ -3593,7 +3593,7 @@ def veorient( elements in a mapped mesh. :ref:`veorient` has no effect on tetrahedron meshes, extruded meshes ( :ref:`vrotat`, :ref:`vdrag`, :ref:`vext`, etc.), or swept meshes ( :ref:`vsweep` ). - Proper brick orientation is essential for certain element types such as ``SOLID185`` Layered + Proper brick orientation is essential for certain element types such as ``SOLID185`` Layered Solid, ``SOLID186`` Layered Solid, and ``SOLSH190``. In such cases, use :ref:`veorient` or :ref:`eorient` to achieve the desired orientation. For other brick element types, you may need to specify element orientation to control orthotropic material property directions without concern for @@ -3790,7 +3790,7 @@ def vsweep( sets volume sweeping options, it does not affect element spacing). Also see the detailed discussion of volume sweeping in `Meshing Your Solid Model `_ - of the `Modeling and Meshing Guide + of the `Modeling and Meshing Guide `_. """ command = f"VSWEEP,{vnum},{srca},{trga},{lsmo}" diff --git a/src/ansys/mapdl/core/_commands/prep7/morphing.py b/src/ansys/mapdl/core/_commands/prep7/morphing.py new file mode 100644 index 00000000000..24a5bf9eb87 --- /dev/null +++ b/src/ansys/mapdl/core/_commands/prep7/morphing.py @@ -0,0 +1,319 @@ +# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class Morphing: + + def damorph( + self, area: str = "", xline: str = "", rmshky: int | str = "", **kwargs + ): + r"""Move nodes in selected areas to conform to structural displacements. + + Mechanical APDL Command: `DAMORPH `_ + + Parameters + ---------- + area : str + Non-structural area to which mesh movement (morph) applies. If ALL, apply morphing to all + selected areas [ASEL]. If ``AREA`` = P, graphical picking is enabled. A component may be + substituted for ``AREA``. + + xline : str + Lines to be excluded from morphing. If ALL, exclude all selected lines [LSEL] from morphing. If + ``XLINE`` = P, graphical picking is enabled. A component may be substituted for ``XLINE``. If + ``XLINE`` is blank (default), allow morphing of nodes attached to lines of the selected areas ( + ``AREA`` ) which are not shared by unselected areas. See Notes for clarification. + + rmshky : int or str + Remesh flag option: + + * ``0`` - Remesh the selected non-structural areas only if mesh morphing fails. + + * ``1`` - Remesh the selected non-structural areas and bypass mesh morphing. + + * ``2`` - Perform mesh morphing only and do not remesh. + + Notes + ----- + + .. _DAMORPH_notes: + + The selected areas should include only non-structural regions adjacent to structural regions. + :ref:`damorph` will morph the non-structural areas to coincide with the deflections of the + structural regions. + + Nodes in the structural regions move in accordance with computed displacements. Displacements from a + structural analysis must be in the database prior to issuing :ref:`damorph`. + + By default, nodes attached to lines can move along the lines, or off the lines (if a line is + interior to the selected areas). You can use ``XLINE`` to restrain nodes on certain lines. + + By default ( ``RMSHKEY`` = 0), :ref:`damorph` will remesh the selected non-structural areas entirely + if a satisfactory morphed mesh cannot be provided. + + If boundary conditions and loads are applied directly to nodes and elements, the :ref:`damorph` + command requires that these be removed before remeshing can take place. + + Exercise care with initial conditions defined by the :ref:`ic` command. Before a structural analysis + is performed for a sequentially coupled analysis, the :ref:`damorph` command requires that initial + conditions be removed from all null element type nodes in the non-structural regions. Use + :ref:`icdele` to delete the initial conditions. + """ + command = f"DAMORPH,{area},{xline},{rmshky}" + return self.run(command, **kwargs) + + def demorph(self, elem: str = "", dimn: str = "", rmshky: int | str = "", **kwargs): + r"""Move nodes in selected elements to conform to structural displacements. + + Mechanical APDL Command: `DEMORPH `_ + + Parameters + ---------- + elem : str + Non-structural elements to which mesh movement (morph) applies. If ALL, apply morphing to all + selected elements ( :ref:`esel` ). If ELEM = P, graphical picking is enabled. A + component may be substituted for ELEM. + + dimn : str + Problem dimensionality. Use "2" for a 2D problem and "3" for a 3D problem (no default). + + rmshky : int or str + Remesh flag option: + + * ``0`` - Remesh the selected non-structural regions only if mesh morphing fails. + + * ``1`` - Remesh the selected non-structural regions and bypass mesh morphing. + + * ``2`` - Perform mesh morphing only and do not remesh. + + Notes + ----- + + .. _DEMORPH_notes: + + The selected elements should include only non-structural regions adjacent to structural regions. The + exterior nodes of the selected elements will usually be on the boundary of the region which will + have node positions displaced. For ``DIMN`` = 2, elements must lie on a flat plane. The + :ref:`demorph` command requires a single domain grouping of elements be provided (multiple domains + of elements are not permitted). Exterior nodes will be assumed fixed (no nodes will be morphed) + unless they coincide with structural nodes having nonzero displacements. + + Nodes in the structural regions move in accordance with computed displacements. Displacements from a + structural analysis must be in the database prior to issuing :ref:`demorph`. + + By default ( ``RMSHKY`` = 0), :ref:`demorph` will remesh the selected non-structural regions + entirely if a satisfactory morphed mesh cannot be provided. + + If boundary conditions and loads are applied directly to nodes and elements, the :ref:`demorph` + command requires that these be removed before remeshing can take place. + + Exercise care with initial conditions defined by the :ref:`ic` command. Before a structural analysis + is performed for a sequentially coupled analysis, the :ref:`demorph` command requires that initial + conditions be removed from all null element type nodes in the non-structural regions. Use + :ref:`icdele` to delete the initial conditions. + """ + command = f"DEMORPH,{elem},{dimn},{rmshky}" + return self.run(command, **kwargs) + + def dvmorph( + self, volu: str = "", xarea: str = "", rmshky: int | str = "", **kwargs + ): + r"""Move nodes in selected volumes to conform to structural displacements. + + Mechanical APDL Command: `DVMORPH `_ + + Parameters + ---------- + volu : str + Non-structural volume to which mesh movement (morph) applies. If ALL, apply morphing to all + selected volumes ( :ref:`vsel` ). If ``VOLU`` = P, graphical picking is enabled. A component may + be substituted for ``VOLU``. + + xarea : str + Areas to be excluded from morphing. If ALL, exclude all selected areas ( :ref:`asel` ). If + ``XAREA`` = P, graphical picking is enabled. A component may be substituted for ``XAREA``. If + ``XAREA`` is blank (default), allow morphing of nodes attached to areas of the selected volumes + ( ``VOLU`` ) which are not shared by unselected volumes. (See Notes for clarification). + + rmshky : int or str + Remesh flag option: + + * ``0`` - Remesh the selected non-structural volumes only if mesh morphing fails. + + * ``1`` - Remesh the selected non-structural volumes and bypass mesh morphing. + + * ``2`` - Perform mesh morphing only and do not remesh. + + Notes + ----- + + .. _DVMORPH_notes: + + The selected volumes should include only non-structural regions adjacent to structural regions. + DVMORPH will morph the non-structural volumes to coincide with the deflections of the structural + regions. + + Nodes in the structural regions move in accordance with computed displacements. Displacements from a + structural analysis must be in the database prior to issuing DVMORPH. + + By default, nodes attached to areas can move along the areas. You can use ``XAREA`` to restrain + nodes on certain areas. + + By default ( ``RMSHKY`` = 0), DVMORPH will remesh the selected non-structural volumes entirely if a + satisfactory morphed mesh cannot be provided. + + If boundary conditions and loads are applied directly to nodes and elements, the DVMORPH command + requires that these be removed before remeshing can take place. + + Exercise care with initial conditions defined by the :ref:`ic` command. Before a structural analysis + is performed for a sequentially coupled analysis, the DVMORPH command requires that initial + conditions be removed from all null element type nodes in the non-structural regions. Use + :ref:`icdele` to delete the initial conditions. + """ + command = f"DVMORPH,{volu},{xarea},{rmshky}" + return self.run(command, **kwargs) + + def morph( + self, + option: str = "", + remeshopt: str = "", + elemset: str = "", + armax: str = "", + voch: str = "", + arch: str = "", + step: str = "", + time: str = "", + stropt: str = "", + **kwargs, + ): + r"""Specifies morphing and remeshing controls. + + Mechanical APDL Command: `MORPH `_ + + Parameters + ---------- + option : str + + * ``OFF`` - Turns off morphing for field elements (default). + + * ``ON`` - Turns on morphing for field elements. + + remeshopt : str + + * ``OFF`` - Do not remesh (default). + + * ``ON`` - Remesh when element qualities fall below values specified by ``ARMAX``, ``VOCH``, or + ``ARCH`` as explained below. Valid only when ``Option`` is ON. + + elemset : str + + * ``ALL`` - Remesh all selected elements if the quality of the worst defined element falls below any + quality requirement (default when ``Remeshopt`` = ON). + + * ``CompName`` - Specify a component name, up to 256 characters. All elements included in this + component name are remeshed if the quality of the worst element falls below any quality requirement. + + armax : str + The maximum allowable element generalized aspect ratio. Defaults to 5. + + voch : str + The maximum allowable change of element size (area or volume). Defaults to 3. + + arch : str + The maximum allowable element aspect ratio change. Defaults to 3. + + step : str + The frequency of element quality checking, based on time steps. A quality check takes place at + the intervals defined by ``STEP``. Defaults to 1 (quality check at every step). + + time : str + A quality check takes place at the time point specified. Defaults to -1 (a quality check at + every time point). + + stropt : str + * ``NO`` - There are no structural elements in the model (default). + + * ``YES`` - There are structural elements in the model and the morphing happens after the structural + solution. + + Notes + ----- + + .. _MORPH_notes: + + :ref:`morph` is applicable to any non-structural field analysis. It activates displacement degrees + of freedom for non-structural elements so that boundary conditions may be placed on the field mesh + to constrain the movement of the non-structural mesh during morphing. It morphs the non-structural + mesh using displacements transferred at the surface interface between the structural field and the + non-structural field. The displacements of non-structural elements are mesh displacements to avoid + mesh distortion, but have no physical meaning except at the interface. :ref:`morph` does not support + surface, link, or shell elements, or any element shape other than triangles, quads, tets, and + bricks. Morphed fields must be in the global Cartesian system ( :ref:`csys` = 0). + + If ``StrOpt`` = YES, the following non-structural element types will be morphed: + + * Acoustic: ``FLUID30``, ``FLUID220``, ``FLUID221``, ``FLUID243``, ``FLUID244``, + + * Electrostatic ``PLANE121``, ``SOLID122``, and ``SOLID123``, + + * Electric ``PLANE230``, ``SOLID231``, and ``SOLID232``, + + * Electromagnetic ``PLANE233``, ``SOLID236``, and ``SOLID237``, + + * Thermal ``PLANE35``, ``PLANE55``, ``PLANE77``, ``PLANE292``, ``PLANE293``, ``SOLID70``, + ``SOLID87``, ``SOLID90``, ``SOLID278``, ``SOLID279``, and ``SOLID291``, + + * Diffusion ``PLANE238``, ``SOLID239``, and ``SOLID240``, + + * Coupled-field ``PLANE222``, ``PLANE223``, ``SOLID225``, ``SOLID226``, and ``SOLID227`` with no + structural degrees of freedom. + + The following structural elements types are supported by ``StrOpt`` = YES: + + * ``PLANE182``, ``PLANE183``, ``SOLID185``, ``SOLID186``, ``SOLID187``, ``SOLSH190``, + + * Coupled-field ``PLANE222``, ``PLANE223``, ``SOLID225``, ``SOLID226``, and ``SOLID227`` with + structural degrees of freedom. + + After each remesh, new databases and results files are written with the extensions :file:`.rth0n` + and :file:`.db0n`, where ``n`` is the remesh file number ( :file:`FieldName.rth01`, + :file:`FieldName.rth02`,... and :file:`FieldName.db01`, :file:`FieldName.db02`, etc.). The original + database file is :file:`FieldName.dbo`. The :file:`FieldName.db01`, :file:`FieldName.db02`, etc. + files have elements that are detached from the solid model. + + Remeshing has the following restrictions: + + * Valid only for the electrostatic elements ( ``PLANE121``, ``SOLID122``, and ``SOLID123`` ) + + * Limited to triangle (2D) and tetrahedral (3D) options of these elements + + * No body loads allowed in the interior nodes of the remeshing domain + + * Nodes on the boundary cannot be remeshed; remeshing will not work if morphing failed on the + surface nodes + + * Not suitable for extreme area or volume changes + + This command is also valid in SOLUTION. + """ + command = f"MORPH,{option},,{remeshopt},{elemset},{armax},{voch},{arch},{step},{time},{stropt}" + return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/__init__.py b/src/ansys/mapdl/core/_commands/preproc/__init__.py index 5a41f85148b..69e22efec00 100644 --- a/src/ansys/mapdl/core/_commands/preproc/__init__.py +++ b/src/ansys/mapdl/core/_commands/preproc/__init__.py @@ -21,17 +21,6 @@ # SOFTWARE. from . import ( - database, - digitizing, - element_type, - elements, - explicit_dynamics, - hard_points, - keypoints, - lines, - material_data_tables, - materials, - morphing, nodes, primitives, real_constants, diff --git a/src/ansys/mapdl/core/_commands/preproc/database.py b/src/ansys/mapdl/core/_commands/preproc/database.py deleted file mode 100644 index 84445dd4c60..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/database.py +++ /dev/null @@ -1,1016 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -""" -These PREP7 commands are used to read model data into the database, -list out the database, and control the numbering of entities in the -database. -""" - - -class Database: - def aflist(self, **kwargs): - """Lists the current data in the database. - - APDL Command: AFLIST - - Notes - ----- - Lists the current data and specifications in the database. If batch, - lists all appropriate data. If interactive, lists only summaries. - """ - command = "AFLIST," - return self.run(command, **kwargs) - - def cdread(self, option="", fname="", ext="", fnamei="", exti="", **kwargs): - """Reads a file of solid model and database information into the database. - - APDL Command: CDREAD - - Parameters - ---------- - option - Selects which data to read: - - ALL - Read all geometry, material property, load, and - component data (default). Solid model geometry and loads - will be read from the file ``Fnamei.Exti``. All other data - will be read from the file ``Fname.Ext``. - - DB - Read all database information contained in file - ``Fname.Ext``. This file should contain all information - mentioned above except the solid model loads. - If reading a ``.CDB`` file written with the ``GEOM`` option - of the ``CDWRITE`` command, element types [``ET``] compatible with the - connectivity of the elements on the file must be defined - prior to reading. - - SOLID - Read the solid model geometry and solid model - loads from the file ``Fnamei.Exti``. - This file could have been written by the ``CDWRITE`` or ``IGESOUT`` command. - - COMB - Read the combined solid model and database - information from the file ``Fname.Ext``. - - fname - File name and directory path (248 characters maximum, including the - characters needed for the directory path). - An unspecified directory path defaults to the working directory; - in this case, you can use all 248 characters for the file name. - - ext - Filename extension (eight-character maximum). If there is an extension in - ``fname``, this option is ignored. - - fnamei - Name of the IGES file and its directory path (248 characters - maximum, including directory). If you do not specify a directory - path, it will default to your working directory and you can use all - 248 characters for the file name. - - exti - Filename extension (eight-character maximum). - - Notes - ----- - This command causes coded files of solid model (in IGES format) and - database (in command format) information to be read. These files are - normally written by the ``CDWRITE`` or ``IGESOUT`` command. Note that the - active coordinate system in these files has been reset to Cartesian - (``CSYS,0``). - - If a set of data exists prior to the ``CDREAD`` operation, that data set is - offset upward to allow the new data to fit without overlap. The - ``NOOFFSET`` command allows this offset to be ignored on a set-by-set - basis, causing the existing data set to be overwritten with the new - data set. - - When you write the geometry data using the ``CDWRITE,GEOM`` option, you use - the ``CDREAD,DB`` option to read the geometry information. - - Using the ``CDREAD,COMB`` option will not write ``NUMOFF`` commands to offset - entity ID numbers if there is no solid model in the database. - - Multiple CDB file imports cannot have elements with real constants in - one file and section definitions in another. The section attributes - will override the real constant attributes. If you use ``CDREAD`` to - import multiple CDB files, define all of the elements using only real - constants, or using only section definitions. Combining real constants - and section definitions is not recommended. - - This command is valid in any processor. - """ - return self.run(f"CDREAD,{option},{fname},{ext},,{fnamei},{exti}", **kwargs) - - def cdwrite( - self, option="", fname="", ext="", fnamei="", exti="", fmat="", **kwargs - ): - """Writes geometry and load database items to a file. - - APDL Command: CDWRITE - - Parameters - ---------- - option - Selects which data to write: - - ALL - Write all appropriate geometry, material property, - load, and component data (default). Two files will - be produced. ``Fname.Ext`` will contain all data items - mentioned in "Notes", except the solid model - data. ``Fnamei.Exti`` will contain the solid model - geometry and solid model loads data in the form of - ``IGES`` commands. This option is not valid when - ``CDOPT,ANF`` is active. - - COMB - Write all data mentioned, but to a single file, - ``Fname.Ext``. Solid model geometry data will be - written in either ``IGES`` or ``ANF`` format as specified - in the ``CDOPT`` command, followed by the remainder of - the data in the form of ANSYS commands. More - information on these (IGES/ANF) file formats is - provided in "Notes". - - DB - Write all database information except the solid model - and solid model loads to ``Fname.Ext`` in the form of - ANSYS commands. This option is not valid when - ``CDOPT,ANF`` is active. - - SOLID - Write only the solid model geometry and solid - model load data. This output will be in IGES or - ANF format, as specified in the ``CDOPT`` - command. More information on these (``IGES/ANF``) file - formats is provided in "Notes". - - GEOM - Write only element and nodal geometry data. Neither - solid model geometry nor element attribute data - will be written. One file, ``Fname.Ext``, will be - produced. Use ``CDREAD,DB`` to read in a file written - with this option. Element types [``ET``] compatible - with the connectivity of the elements on the file - must first be defined before reading the file in - with ``CDREAD,DB``. - - CM - Write only node and element component and geometry - data to ``Fname.Ext``. - - MAT - Write only material property data (both linear and - nonlinear) to ``Fname.Ext``. - - LOAD - Write only loads for current load step to - ``Fname.Ext``. - - SECT - Write only section data to ``Fname.Ext``. Pretension - sections are not included. - - fname - File name and directory path (248 characters maximum, - including the characters needed for the directory path). - An unspecified directory path defaults to the working - directory; in this case, you can use all 248 characters - for the file name. - - ext - Filename extension (eight-character maximum). - - fnamei - Name of the IGES file and its directory path (248 - characters maximum, including directory). If you do not - specify a directory path, it will default to your working - directory and you can use all 248 characters for the file - name. - - exti - Filename extension (eight-character maximum). - - fmat - Format of the output file (defaults to BLOCKED). - - BLOCKED - Blocked format. This format allows faster - reading of the output file. The time savings is - most significant when BLOCKED is used to read - .cdb files associated with very large models. - - UNBLOCKED - Unblocked format. - - Returns - ------- - str - Mapdl command output. - - Notes - ----- - Load data includes the current load step only. Loads applied - to the solid model (if any) are automatically transferred to - the finite element model when this command is issued. CDWRITE - writes out solid model loads for meshed models only. If the - model is not meshed, the solid model loads cannot be - saved. Component data include component definitions, but not - assembly definitions. Appropriate ``NUMOFF`` commands are included - at the beginning of the file; this is to avoid overlap of an - existing database when the file is read in. - - Element order information (resulting from a WAVES command) is - not written. The data in the database remain untouched. - - Solution control commands are typically not written to the - file unless you specifically change a default solution - setting. - - ``CDWRITE`` does not support the ``GSBDATA`` and ``GSGDATA`` commands, and - these commands are not written to the file. - - The data may be reread (on a different machine, for example) - with the ``CDREAD`` command. Caution: When the file is read in, - the ``NUMOFF,MAT`` command may cause a mismatch between material - definitions and material numbers referenced by certain loads - and element real constants. See ``NUMOFF`` for details. Also, be - aware that the files created by the CDWRITE command explicitly - set the active coordinate system to Cartesian (``CSYS,0``). - - You should generally use the blocked format (Fmat = BLOCKED) - when writing out model data with CDWRITE. This is a compressed - data format that greatly reduces the time required to read - large models through the CDREAD command. The blocked and - unblocked formats are described in Chapter 3 of the Guide to - Interfacing with ANSYS. - - If you use ``CDWRITE`` in any of the derived products (ANSYS Emag, - ANSYS Professional), then before reading the file, you must - edit the ``Jobname.cdb`` file to remove commands that are not - available in the respective component product. - - The ``CDWRITE`` command writes PART information for any ANSYS - LS-DYNA input file to the ``Jobname.cdb`` file via the ``EDPREAD`` - command. (``EDPREAD`` is not a documented command; it is written - only when the ``CDWRITE`` command is issued.) The PART information - can be automatically read in via the ``CDREAD`` command; however, - if more than one ``Jobname.cdb`` file is read, the PART list from - the last ``Jobname.cdb`` file overwrites the existing PART list of - the total model. This behavior affects all PART-related - commands contained in the ``Jobname.cdb`` file. You can join - models, but not PART-related inputs, which you must modify - using the newly-created PART numbers. In limited cases, an - update of the PART list (``EDWRITE,PUPDATE``) is possible; doing - so requires that no used combination of ``MAT/TYPE/REAL`` appears - more than once in the list. - - The ``CDWRITE`` command does not support (for beam meshing) any - line operation that relies on solid model associativity. For - example, meshing the areas adjacent to the meshed line, - plotting the line that contains the orientation nodes, or - clearing the mesh from the line that contains orientation - nodes may not work as expected. For more information about - beam meshing, see Meshing Your Solid Model in the Modeling and - Meshing Guide. - - IGES and ANF File Formats for Solid Model Geometry Information - - The format used for solid model geometry information is - determined by the current ``CDOPT`` command setting. The default - format is ``IGES``. - - IGES option (default) to write solid model information (``CDOPT, - IGS``): - - Before writing solid model entities, select all corresponding - lower level entities (ALLSEL,BELOW,ALL). - - Examples - -------- - Create a basic block and save it to disk. - - >>> mapdl.prep7() - >>> mapdl.block(0, 1, 0, 1, 0, 1) - >>> mapdl.et(1, 186) - >>> mapdl.esize(0.25) - >>> mapdl.vmesh('ALL') - >>> mapdl.cdwrite('DB', '/tmp/mesh.cdb') - TITLE = - NUMBER OF ELEMENT TYPES = 1 - 64 ELEMENTS CURRENTLY SELECTED. MAX ELEMENT NUMBER = 64 - 425 NODES CURRENTLY SELECTED. MAX NODE NUMBER = 425 - 8 KEYPOINTS CURRENTLY SELECTED. MAX KEYPOINT NUMBER = 8 - 12 LINES CURRENTLY SELECTED. MAX LINE NUMBER = 12 - 6 AREAS CURRENTLY SELECTED. MAX AREA NUMBER = 6 - 1 VOLUMES CURRENTLY SELECTED. MAX VOL. NUMBER = 1 - WRITE ANSYS DATABASE AS AN ANSYS INPUT FILE: /tmp/mesh.cdb - - Optionally load the mesh into Python using the archive reader. - - >>> from ansys.mapdl import reader as pymapdl_reader - >>> mesh = pymapdl_reader.Archive('/tmp/mesh.cdb') - >>> mesh - ANSYS Archive File mesh.cdb - Number of Nodes: 425 - Number of Elements: 64 - Number of Element Types: 1 - Number of Node Components: 0 - Number of Element Components: 0 - """ - command = f"CDWRITE,{option},'{fname}',{ext},,{fnamei},{exti},{fmat}" - return self.run(command, **kwargs) - - def cdopt(self, option="", **kwargs): - """Specifies format to be used for archiving geometry. - - APDL Command: CDOPT - - Parameters - ---------- - option - IGES - - IGES - Write solid model geometry information using IGES format (default). - - ANF - Write solid model geometry information using ANSYS Neutral File format. - - STAT - Print out the current format setting. - - Notes - ----- - This command controls your solid model geometry format for CDWRITE - operations. The ANF option affects only the COMB and SOLID options of - the CDWRITE command. All other options remain unaffected. - - This option setting is saved in the database. - """ - command = "CDOPT,%s" % (str(option)) - return self.run(command, **kwargs) - - def cecheck(self, itemlab="", tolerance="", dof="", **kwargs): - """Check constraint equations and couplings for rigid body motions. - - APDL Command: CECHECK - - Parameters - ---------- - itemlab - Item indicating what is to be checked: - - CE - Check constraint equations only - - CP - Check couplings only - - ALL - Check both CE and CP - - tolerance - Allowed amount of out-of-balance for any constraint equation or - coupled set. The default value of 1.0e-6 is usually good. - - dof - Specifies which DOF is to be checked. Default is RIGID, the usual - option. Other choices are individual DOF such as UX, ROTZ, etc. or - THERM. The THERM option will check the constraint equations or - coupled sets for free thermal expansions, whereas the individual - DOFs check under rigid body motions. ALL is RIGID and THERM. - - Notes - ----- - This command imposes a rigid body motion on the nodes attached to the - constraint equation or coupled set and makes sure that no internal - forces are generated for such rigid body motions. Generation of - internal forces by rigid body motions usually indicates an error in the - equation specification (possibly due to nodal coordinate rotations). - The THERM option does a similar check to see that no internal forces - are created by the equations if the body does a free thermal expansion - (this check assumes a single isotropic coefficient of expansion). - """ - command = "CECHECK,%s,%s,%s" % (str(itemlab), str(tolerance), str(dof)) - return self.run(command, **kwargs) - - def check(self, sele="", levl="", **kwargs): - """Checks current database items for completeness. - - APDL Command: CHECK - - Parameters - ---------- - sele - Specifies which elements are to be checked: - - (blank) - Check all data. - - ESEL - Check only elements in the selected set and unselect any elements not producing - geometry check messages. The remaining elements (those - producing check messages) can then be displayed and - corrected. A null set results if no elements produce a - message. Issue ESEL,ALL to select all elements before - proceeding. - - levl - Used only with Sele = ESEL: - - WARN - Select elements producing warning and error messages. - - ERR - Select only elements producing error messages (default). - - Notes - ----- - This command will not work if SHPP,OFF has been set. A similar, - automatic check of all data is done before the solution begins. - - If the "Check Elements" option is invoked through the GUI (menu path - Main Menu> Preprocessor> Meshing> Check Elems), the CHECK,ESEL logic is - used to highlight elements in the following way: good elements are - blue, elements having warnings are yellow, and bad (error) elements are - red. - - Note:: : The currently selected set of elements is not changed by this - GUI function. - - This command is also valid in PREP7. - """ - command = "CHECK,%s,%s" % (str(sele), str(levl)) - return self.run(command, **kwargs) - - def igesout(self, fname="", ext="", att="", **kwargs): - """Writes solid model data to a file in IGES Version 5.1 format. - - APDL Command: IGESOUT - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, including the - characters needed for the directory path). An unspecified - directory path defaults to the working directory; in this case, you - can use all 248 characters for the file name. - - ext - Filename extension (eight-character maximum). - - att - Attribute key: - - 0 - Do not write assigned numbers and attributes of the - solid model entities to the IGES file (default). - - 1 - Write assigned numbers and attributes of solid model - entities (keypoints, lines, areas, volumes) to the - IGES file. Attributes include MAT, TYPE, REAL, and - ESYS specifications as well as associated solid model - loads and meshing (keypoint element size, number of - line divisions and spacing ratio) specifications. - - Notes - ----- - Causes the selected solid model data to be written to a coded - file in the IGES Version 5.1 format. Previous data on this - file, if any, are overwritten. Keypoints that are not - attached to any line are written to the output file as IGES - entity 116 (Point). Lines that are not attached to any area - are written to the output file as either IGES Entity 100 - (Circular Arc), 110 (Line), or 126 (Rational B-Spline Curve) - depending upon whether the ANSYS entity was defined as an arc, - straight line, or spline. Areas are written to the output - file as IGES Entity 144 (Trimmed Parametric Surface). Volumes - are written to the output file as IGES entity 186 (Manifold - Solid B-Rep Object). Solid model entities to be written must - have all corresponding lower level entities selected (use - ALLSEL,BELOW,ALL) before issuing command. Concatenated lines - and areas are not written to the IGES file; however, the - entities that make up these concatenated entities are written. - - Caution:: : Section properties assigned to areas, lines and - other solid model entities will not be maintained when the - model is exported using IGESOUT. - - If you issue the IGESOUT command after generating a beam mesh - with orientation nodes, the orientation keypoints that were - specified for the line (LATT) are no longer associated with - the line and are not written out to the IGES file. The line - does not recognize that orientation keypoints were ever - assigned to it, and the orientation keypoints do not "know" - that they are orientation keypoints. Thus the IGESOUT command - does not support (for beam meshing) any line operation that - relies on solid model associativity. For example, meshing the - areas adjacent to the meshed line, plotting the line that - contains the orientation nodes, or clearing the mesh from the - line that contains orientation nodes may not work as expected. - See Meshing Your Solid Model in the Modeling and Meshing Guide - for more information about beam meshing. - """ - return self.run(f"IGESOUT,{fname},{ext},,{att}", **kwargs) - - def mfimport(self, fnumb="", option="", fname="", ext="", **kwargs): - """Imports a new field into a current ANSYS Multi-field solver analysis. - - APDL Command: MFIMPORT - - Parameters - ---------- - fnumb - Field number specified by the MFELEM command. - - option - Selects data to read. - - DB - Reads a CDB file. The CDB file name and extension are specified by Fname and - Ext. - - fname - File name and directory path (248 characters maximum, including the - characters needed for the directory path). An unspecified - directory path defaults to the working directory; in this case, you - can use all 248 characters for the file name. - - ext - Filename extension (eight-character maximum). - - Notes - ----- - The field to be imported should be written to a CDB file (CDWRITE - command). This file is read into the database, offsetting all existing - element type numbers, node numbers, etc. in order to accommodate the - imported field. (See the NUMOFF command for information on offset - capabilities.) It then updates all of the previously issued MFxx - commands to the new element type numbers. A new field is created using - the specified field number, which must not currently exist. If there - are no ANSYS Multi-field solver command files written for the existing - fields in the database, one will be written for each field with the - default name (see the MFCMMAND command). A MFCMMAND will be issued for - the imported field as well. - - Repeat the MFIMPORT command to import additional fields. - - See Multi-field Commands in the Coupled-Field Analysis Guide for a list - of all ANSYS Multi-field solver commands and their availability for MFS - and MFX analyses. - - Distributed ANSYS Restriction: This command is not supported in - Distributed ANSYS. - """ - command = "MFIMPORT,%s,%s,%s,%s" % ( - str(fnumb), - str(option), - str(fname), - str(ext), - ) - return self.run(command, **kwargs) - - def nooffset(self, label="", **kwargs): - """Prevents the CDREAD command from offsetting specified data items - - APDL Command: NOOFFSET - - Parameters - ---------- - label - Specifies items not to be offset. - - - ``"NODE"`` : Node numbers - - ``"ELEM"`` : Element numbers - - ``"KP"`` : Keypoint numbers - - ``"LINE"`` : Line numbers - - ``"AREA"`` : Area numbers - - ``"VOLU"`` : Volume numbers - - ``"MAT"`` : Material numbers - - ``"TYPE"`` : Element type numbers - - ``"REAL"`` : Real constant numbers - - ``"CSYS"`` : Coordinate system numbers - - ``"SECN"`` : Section numbers - - ``"CP"`` : Coupled set numbers - - ``"CE"`` : Constraint equation numbers - - ``"CLEAR"`` : All items will be offset - - ``"STATUS"`` : Shows which items are specified not to be offset. - - Notes - ----- - The NOOFFSET command specifies data items not to be offset by a set of - data read from a CDREAD command. - """ - command = "NOOFFSET,%s" % (str(label)) - return self.run(command, **kwargs) - - def numcmp(self, label="", **kwargs): - """Compresses the numbering of defined items. - - APDL Command: NUMCMP - - Parameters - ---------- - label - Items to be compressed: - - NODE - Node numbers - - ELEM - Element numbers - - KP - Keypoint numbers - - LINE - Line numbers - - AREA - Area numbers - - VOLU - Volume numbers - - MAT - Material numbers - - TYPE - Element type numbers - - REAL - Real constant numbers - - CP - Coupled set numbers - - SECN - Section numbers - - CE - Constraint equation numbers - - ALL - All item numbers - - Notes - ----- - The NUMCMP command effectively compresses out unused item - numbers by renumbering all the items, beginning with one and - continuing throughout the model. The renumbering order - follows the initial item numbering order (that is, compression - lowers the maximum number by "sliding" numbers down to take - advantage of unused or skipped numbers). All defined items - are renumbered, regardless of whether or not they are actually - used or selected. Applicable related items are also checked - for renumbering as described for the merge operation (NUMMRG). - - Compressing material numbers (NUMCMP,ALL or NUMCMP,MAT) does - not update the material number referenced by either of the - following: - - A temperature-dependent convection or surface-to-surface - radiation load (SF, SFE, SFL, SFA) - - Real constants for multi-material elements (such as SOLID65) - - Compression is usually not required unless memory space is limited and - there are large gaps in the numbering sequence. - """ - command = "NUMCMP,%s" % (str(label)) - return self.run(command, **kwargs) - - def nummrg(self, label="", toler="", gtoler="", action="", switch="", **kwargs): - """Merges coincident or equivalently defined items. - - APDL Command: NUMMRG - - Parameters - ---------- - label - Items to be merged: - - NODE - Nodes - - ELEM - Elements - - KP - Keypoints (will also merge lines, areas, and volumes) - - MAT - Materials - - TYPE - Element types - - REAL - Real constants - - CP - Coupled sets - - CE - Constraint equations - - ALL - All items - - toler - Range of coincidence. For Label = NODE and KP, defaults to 1.0E-4 - (based on maximum Cartesian coordinate difference between nodes or - keypoints). For Label = MAT, REAL, and CE, defaults to 1.0E-7 - (based on difference of the values normalized by the values). Only - items within range are merged. (For keypoints attached to lines, - further restrictions apply. See the GTOLER field and Merging Solid - Model Entities below.) - - gtoler - Global solid model tolerance -- used only when merging keypoints - attached to lines. If specified, GTOLER will override the internal - relative solid model tolerance. See Merging Solid Model Entities - below. - - action - Specifies whether to merge or select coincident items. - - SELE - Select coincident items but do not merge. Action = SELE is only valid for Label - = NODE. - - (Blank) - Merge the coincident items (default). - - switch - Specifies whether the lowest or highest numbered coincident item is - retained after the merging operation. This option does not apply - to keypoints; i.e., for Label = KP, the lowest numbered keypoint is - retained regardless of the Switch setting. - - LOW - Retain the lowest numbered coincident item after the merging operation - (default). - - HIGH - Retain the highest numbered coincident item after the merging operation. - - Notes - ----- - After issuing the command, the area and volume sizes (ASUM and VSUM) - may give slightly different results. In order to obtain the same - results as before, use /FACET, /NORMAL, and ASUM / VSUM. - - The merge operation is useful for tying separate, but coincident, parts - of a model together. If not all items are to be checked for merging, - use the select commands (NSEL, ESEL, etc.) to select items. Only - selected items are included in the merge operation for nodes, - keypoints, and elements. - - By default, the merge operation retains the lowest numbered coincident - item. Higher numbered coincident items are deleted. Set Switch to - HIGH to retain the highest numbered coincident item after the merging - operation. Applicable related items are also checked for deleted item - numbers and if found, are replaced with the retained item number. For - example, if nodes are merged, element connectivities (except - superelements), mesh item range associativity, coupled degrees of - freedom, constraint equations, master degrees of freedom, gap - conditions, degree of freedom constraints, nodal force loads, nodal - surface loads, and nodal body force loads are checked. Merging - material numbers [NUMMRG,ALL or NUMMRG,MAT] does not update the - material number referenced: - - By temperature-dependent film coefficients as part of convection load - or a temperature-dependent emissivity as part of a surface-to-surface - radiation load [SF, SFE, SFL, SFA] - - By real constants for multi-material elements (such as SOLID65) - - If a unique load is defined among merged nodes, the value is kept and - applied to the retained node. If loads are not unique (not - recommended), only the value on the lowest node (or highest if Switch = - HIGH) will be kept, except for "force" loads for which the values will - be summed if they are not defined using tabular boundary conditions. - - Note:: The unused nodes (not recommended) in elements, couplings, - constraint equations, etc. may become active after the merge operation. - - The Action field provides the option of visualizing the coincident - items before the merging operation. - - Caution:: When merging entities in a model that has already been - meshed, the order in which you issue multiple NUMMRG commands is - significant. If you want to merge two adjacent meshed regions that - have coincident nodes and keypoints, always merge nodes [NUMMRG,NODE] - before merging keypoints [NUMMRG,KP]. Merging keypoints before nodes - can result in some of the nodes becoming "orphaned"; that is, the nodes - lose their association with the solid model. Orphaned nodes can cause - certain operations (such as boundary condition transfers, surface load - transfers, and so on) to fail. However, using NUMMRG should be avoided - if at all possible, as the procedure outlined above may even cause - meshing failure, especially after multiple merging and meshing - operations. - - After a NUMMRG,NODE, is issued, some nodes may be attached to more than - one solid entity. As a result, subsequent attempts to transfer solid - model loads to the elements may not be successful. Issue NUMMRG,KP to - correct this problem. Do NOT issue VCLEAR before issuing NUMMRG,KP. - - For NUMMRG,ELEM, elements must be identical in all aspects, including - the direction of the element coordinate system. - - For certain solid and shell elements (181, 185, 190, etc) ANSYS will - interpret coincident faces as internal and eliminate them. To prevent - this from occurring, shrink the entities by a very small factor to - delineate coincident items (/SHRINK, 0.0001) and no internal nodes, - lines, areas or elements will be eliminated. - - When working with solid models, you may have better success with the - gluing operations (AGLUE, LGLUE, VGLUE). Please read the following - information when attempting to merge solid model entities. - - Gluing Operations vs. Merging Operations - - Adjacent, touching regions can be joined by gluing them (AGLUE, LGLUE, - VGLUE) or by merging coincident keypoints (NUMMRG,KP, which also causes - merging of identical lines, areas, and volumes). In many situations, - either approach will work just fine. Some factors, however, may lead to - a preference for one method over the other. - - Geometric Configuration - - Gluing is possible regardless of the initial alignment or offset of the - input entities. Keypoint merging is possible only if each keypoint on - one side of the face to be joined is matched by a coincident keypoint - on the other side. This is commonly the case after a symmetry - reflection (ARSYM or VSYMM) or a copy (AGEN or VGEN), especially for a - model built entirely in ANSYS rather than imported from a CAD system. - When the geometry is extremely precise, and the configuration is - correct for keypoint merging, NUMMRG is more efficient and robust than - AGLUE or VGLUE. - """ - command = "NUMMRG,%s,%s,%s,%s,%s" % ( - str(label), - str(toler), - str(gtoler), - str(action), - str(switch), - ) - return self.run(command, **kwargs) - - def numoff(self, label="", value="", **kwargs): - """Adds a number offset to defined items. - - APDL Command: NUMOFF - - Parameters - ---------- - label - Apply offset number to one of the following sets of items: - - NODE - Nodes - - ELEM - Elements - - KP - Keypoints - - LINE - Lines - - AREA - Areas - - VOLU - Volumes - - MAT - Materials - - TYPE - Element types - - REAL - Real constants - - CP - Coupled sets - - SECN - Section numbers - - CE - Constraint equations - - CSYS - Coordinate systems - - value - Offset number value (cannot be negative). - - Notes - ----- - Useful for offsetting current model data to prevent overlap if another - model is read in. CDWRITE automatically writes the appropriate NUMOFF - commands followed by the model data to File.CDB. Therefore, when the - file is read, any model already existing in the database is offset - before the model data on the file is read. - - Offsetting material numbers with this command [NUMOFF,MAT] does not - update the material number referenced by either of the following: - - A temperature-dependent convection or surface-to-surface radiation load - [SF, SFE, SFL, SFA] - - Real constants for multi-material elements (such as SOLID65). - - Therefore, a mismatch may exist between the material definitions and - the material numbers referenced. - """ - command = "NUMOFF,%s,%s" % (str(label), str(value)) - return self.run(command, **kwargs) - - def numstr(self, label="", value="", **kwargs): - """Establishes starting numbers for automatically numbered items. - - APDL Command: NUMSTR - - Parameters - ---------- - label - Apply starting number to one of the following sets of items: - - NODE - Node numbers. Value defaults (and is continually reset) to 1 + maximum node - number in model. Cannot be reset lower. - - ELEM - Element numbers. Value defaults (and is continually reset) to 1 + maximum - element number in model. Cannot be reset lower. - - KP - Keypoint numbers. Value defaults to 1. Only undefined numbers are used. - Existing keypoints are not overwritten. - - LINE - Line numbers. Value defaults to 1. Only undefined numbers are used. Existing - lines are not overwritten. - - AREA - Area numbers. Value defaults to 1. Only undefined numbers are used. Existing - areas are not overwritten. - - VOLU - Volume numbers. Value defaults to 1. Only undefined numbers are used. - Existing volumes are not overwritten. - - DEFA - Default. Returns all starting numbers to their default values. - - value - Starting number value. - - Notes - ----- - Establishes starting numbers for various items that may have numbers - automatically assigned (such as element numbers with the EGEN command, - and node and solid model entity numbers with the mesh [AMESH, VMESH, - etc.] commands). Use NUMSTR,STAT to display settings. Use NUMSTR,DEFA - to reset all specifications back to defaults. Defaults may be lowered - by deleting and compressing items (i.e., NDELE and NUMCMP,NODE for - nodes, etc.). - - Note:: : A mesh clear operation (VCLEAR, ACLEAR, LCLEAR, and KCLEAR) - automatically sets starting node and element numbers to the highest - unused numbers. If a specific starting node or element number is - desired, issue NUMSTR after the clear operation. - """ - command = "NUMSTR,%s,%s" % (str(label), str(value)) - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/digitizing.py b/src/ansys/mapdl/core/_commands/preproc/digitizing.py deleted file mode 100644 index 822cea44505..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/digitizing.py +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Digitizing: - def dig(self, node1="", node2="", ninc="", **kwargs): - """Digitizes nodes to a surface. - - APDL Command: DIG - - Parameters - ---------- - node1, node2, ninc - Digitize nodes NODE1 through NODE2 in steps of NINC. NODE2 - defaults to NODE1 and NINC defaults to 1. - - Notes - ----- - Digitizes nodes to the surface defined by the DSURF command. The nodes - indicated must be digitized from the tablet after this command is - given. The program must be in the interactive mode and the graphics - terminal show option [/SHOW] must be active. The global Cartesian - coordinates of the nodes are stored. - """ - command = f"DIG,{node1},{node2},{ninc}" - return self.run(command, **kwargs) - - def dmove(self, node1="", node2="", ninc="", **kwargs): - """Digitizes nodes on surfaces and along intersections. - - APDL Command: DMOVE - - Parameters - ---------- - node1, node2, ninc - Digitize nodes NODE1through NODE2 in steps of NINC. NODE2 defaults - to NODE1 and NINC defaults to 1. - - Notes - ----- - Digitizes nodes on undefined surfaces, warped surfaces, and along - intersection lines. Two orthogonal views showing the nodes on a plane - in each view are required. No surfaces need be specified. Two - coordinates are determined from the second view and the other - coordinate is retained from the first view. Use the DIG command to - first define nodes in one view (as determined from the DSET command). - Then reset the view and use this command to move the nodes to the - proper location. - """ - command = f"DMOVE,{node1},{node2},{ninc}" - return self.run(command, **kwargs) - - def dset(self, node1="", node2="", node3="", ddev="", **kwargs): - """Sets the scale and drawing plane orientation for a digitizing tablet. - - APDL Command: DSET - - Parameters - ---------- - node1, node2, node3 - Any three (noncolinear) nodes defining a plane parallel to the - drawing. Nodes and actual locations (in any coordinate system) - must have been previously defined. - - ddev - Digitizing device type number (device dependent). - - Notes - ----- - Sets drawing scale size and defines the drawing plane orientation for - use with a digitizing tablet. Drawings must be to scale. Views must - represent standard orthogonal parallel projections. The three nodes - indicated must be digitized [DIG] from the tablet after this command is - issued. - """ - command = f"DSET,{node1},{node2},{node3},{ddev}" - return self.run(command, **kwargs) - - def dsurf(self, kcn="", xsurf="", ysurf="", zsurf="", **kwargs): - """Defines the surface upon which digitized nodes lie. - - APDL Command: DSURF - - Parameters - ---------- - kcn - Surface is located in coordinate system KCN. KCN may be 0,1,2 or - any previously defined local coordinate system number. - - xsurf, ysurf, zsurf - Input one value to define the surface constant. Input 999 in the - other two fields. Interpret fields as R, θ, Z for cylindrical or - R, θ, Φ for spherical or toroidal coordinate systems. XSURF and - YSURF default to 999 if KCN = 0. - - Notes - ----- - Defines the surface upon which the nodes to be digitized (with the DIG - command) actually lie. Surfaces are defined by a coordinate system - number and a coordinate constant [MOVE]. Two coordinates are - determined from the drawing and converted to surface coordinates. The - third coordinate is defined from the input surface constant. If nodes - lie on warped or undefined surfaces, use the DMOVE command. - """ - command = f"DSURF,{kcn},{xsurf},{ysurf},{zsurf}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/element_type.py b/src/ansys/mapdl/core/_commands/preproc/element_type.py deleted file mode 100644 index 0bab7846063..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/element_type.py +++ /dev/null @@ -1,498 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -""" -These PREP7 commands define the type of elements to be used in the model. -""" -from typing import Optional, Union - -from ansys.mapdl.core._commands import parse -from ansys.mapdl.core.mapdl_types import MapdlInt - - -class ElementType: - def dof( - self, - lab1="", - lab2="", - lab3="", - lab4="", - lab5="", - lab6="", - lab7="", - lab8="", - lab9="", - lab10="", - **kwargs, - ): - """Adds degrees of freedom to the current DOF set. - - APDL Command: DOF - - Parameters - ---------- - lab1, lab2, lab3, . . . , lab10 - Valid labels are: UX, UY, UZ (structural displacements); ROTX, - ROTY, ROTZ (structural rotations); TEMP, TBOT, TE2, TE3, . . ., - TTOP (temperatures); PRES (pressure); VOLT (voltage); MAG - (magnetic scalar potential); AX, AY, AZ (magnetic vector - potentials); CURR (current); EMF (electromotive force drop); CONC - (concentration); DELETE. - - Notes - ----- - The degree of freedom (DOF) set for the model is determined from all - element types defined. This command may be used to add to the current - set. The ALL label may be used on some commands to represent all - labels of the current degree of freedom set for the model. Issue the - DOF command with no arguments to list the current set. Use the DELETE - label to delete any previously added DOFs and return to the default DOF - set. - """ - command = "DOF,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % ( - str(lab1), - str(lab2), - str(lab3), - str(lab4), - str(lab5), - str(lab6), - str(lab7), - str(lab8), - str(lab9), - str(lab10), - ) - return self.run(command, **kwargs) - - def elbow( - self, - transkey="", - tol="", - dof="", - cons1="", - cons2="", - cons3="", - cons4="", - **kwargs, - ): - """APDL Command: ELBOW - - Specifies degrees of freedom to be coupled for end release and applies - section constraints to elbow elements. - - Parameters - ---------- - transkey - Pipe-to-elbow transition flag: - - OFF - Do not automatically transition pipes to elbows. (This behavior is the - default.) - - ON - Automatically convert straight PIPE289 elements to ELBOW290 elements where it - is beneficial. The program converts elements in transition - regions where curved ELBOW290 elements are connected to - straight PIPE289 elements. - - tol - Angle tolerance (in degrees) between adjacent ELBOW290 elements. - The default value is 20. A value of -1 specifies all selected - ELBOW290 elements. - - dof - Degrees of freedom to couple: - - ALL - Couple all nodal degrees of freedom (UX, UY, UZ, ROTX, ROTY, and ROTZ). This - behavior is the default. - - BALL - Create ball joints (equivalent to releasing ROTX, ROTY, and ROTZ). - - cons1, cons2, cons3, cons4 - Section degrees of freedoms to constrain. If Cons1 through Cons4 - are unspecified, no section constraints are applied: - - SECT - All section deformation - - SE - Section radial expansion - - SO - Section ovalization - - SW - Section warping - - SRA - Local shell normal rotation about cylindrical axis t2 - - SRT - Local shell normal rotation about cylindrical axis t1 - - Notes - ----- - The ELBOW command specifies end releases and section constraints for - ELBOW290 elements and converts straight PIPE289 elements to ELBOW290 - elements. - - Curved PIPE289 elements are not converted to ELBOW290 elements. - - ELBOW290 elements are generated only if there are existing ELBOW290 - elements in the curved areas. - - The command works on currently selected nodes and elements. It creates - end releases on any two connected elbow elements whose angle at - connection exceeds the specified tolerance. From within the GUI, the - Picked node option generates an end release and section constraints at - the selected node regardless of the angle of connection (that is, the - angle tolerance [TOL ] is set to -1). - - Elbow and pipe elements must share the same section ID in order for the - pipe-to-elbow transition to occur. - - To list the elements altered by the ELBOW command, issue an ELIST - command. - - To list the coupled sets generated by the ELBOW command, issue a CPLIST - command. - - To list the section constraints generated by the ELBOW command, issue a - DLIST command. - """ - command = "ELBOW,%s,%s,%s,%s,%s,%s,%s" % ( - str(transkey), - str(tol), - str(dof), - str(cons1), - str(cons2), - str(cons3), - str(cons4), - ) - return self.run(command, **kwargs) - - def et( - self, - itype: MapdlInt = "", - ename: Union[str, int] = "", - kop1: MapdlInt = "", - kop2: MapdlInt = "", - kop3: MapdlInt = "", - kop4: MapdlInt = "", - kop5: MapdlInt = "", - kop6: MapdlInt = "", - inopr: MapdlInt = "", - **kwargs, - ) -> Optional[int]: - """Define a local element type from the element library. - - APDL Command: ET - - Parameters - ---------- - itype - Arbitrary local element type number. Defaults to 1 + - current maximum. - - ename - Element name (or number) as given in the element library - in Chapter 4 of the Element Reference. The name consists - of a category prefix and a unique number, such as PIPE288. - The category prefix of the name (PIPE for the example) may - be omitted but is displayed upon output for clarity. If - ``ename=0``, the element is defined as a null element. - - kop1, kop2, kop3, kop4, kop5, kop6 - KEYOPT values (1 through 6) for this element, as described - in the Element Reference. - - inopr - If 1, suppress all element solution printout for this - element type. - - Notes - ----- - The ET command selects an element type from the element - library and establishes it as a local element type for the - current model. Information derived from the element type is - used for subsequent commands, so the ET command(s) should be - issued early. (The Element Reference describes the available - elements.) - - A special option, ``ename=0``, permits the specified element - type to be ignored during solution without actually removing - the element from the model. Ename may be set to zero only - after the element type has been previously defined with a - nonzero Ename. The preferred method of ignoring elements is - to use the select commands (such as ESEL). - - KOPn are element option keys. These keys (referred to as - KEYOPT(n)) are used to turn on certain element options for - this element. These options are listed under "KEYOPT" in the - input table for each element type in the Element Reference. - KEYOPT values include stiffness formulation options, printout - controls, and various other element options. If KEYOPT(7) or - greater is needed, input their values with the KEYOPT command. - - The ET command only defines an element type local to your - model (from the types in the element library). The TYPE or - similar [KATT, LATT, AATT, or VATT] command must be used to - point to the desired local element type before meshing. - - To activate the ANSYS program's LS-DYNA explicit dynamic - analysis capability, use the ET command - to choose an element that works only with LS-DYNA (such as - SHELL163). - - Examples - -------- - Define an element type. Allow MAPDL to pick your the element - type. - - >>> etype_num = mapdl.et('', 'SURF154') - >>> etype_num - 1 - - Define an element type while specifying the element type - number. - - >>> etype_num = mapdl.et(2, 'SOLID186') - >>> etype_num - 2 - """ - command = ( - f"ET,{itype},{ename},{kop1},{kop2},{kop3},{kop4},{kop5},{kop6},{inopr}" - ) - return parse.parse_et(self.run(command, **kwargs)) - - def etchg(self, cnv: str = "", **kwargs) -> Optional[str]: - """Changes element types to their corresponding types. - - APDL Command: ETCHG - - Parameters - ---------- - cnv - Converts the element types to the corresponding type. - Valid labels - are: - - ETI - Explicit to Implicit - - ITE - Implicit to Explicit - - TTE - Thermal to Explicit - - TTS - Thermal to Structural - - STT - Structural to Thermal - - MTT - Magnetic to Thermal - - FTS - Fluid to Structural - - ETS - Electrostatic to Structural - - ETT - Electrical to Thermal - - Notes - ----- - Changes the currently defined element types to their - corresponding types. Elements without a companion element - (listed above) are not switched and should be switched with - the ET command to an appropriate element type or to a null - element. The KEYOPT values for the switched element types are - reset to zero or to their default values. You must - check these values to see if they are still meaningful. - Additionally, if Cnv = ETI, ITE, or TTE, all real constants - are set to zero. - - If Cnv = ITE, you will need to choose a material model that - corresponds to your previously-defined material properties. - If working interactively, you will be prompted to do so. - """ - command = f"ETCHG,{cnv}" - return self.run(command, **kwargs) - - def etcontrol( - self, eltech: str = "", eldegene: str = "", **kwargs - ) -> Optional[str]: - """Control the element technologies used in element - formulation (for applicable elements). - - APDL Command: ETCONTROL - - Parameters - ---------- - eltech - Element technology control. One of the following: - - - ``"SUGGESTION"`` : The program offers a suggestion for the - best element technology before solving. If necessary, - mixed u-P (KEYOPT(6)) is also included and reset. This - behavior is the default. - - - ``"SET"`` : The program informs you of the best settings - and resets any applicable KEYOPT settings - automatically. This action overrides any previous manual - settings. - - - ``"OFF"`` : Deactivates automatic selection of element - technology. No suggestions are issued, and no - automatic resetting occurs. - - eldegene - Element degenerated shape control. One of the following: - - - ``"ON"`` - If element shapes are degenerated, the - degenerated shape function is employed and enhanced - strain, simplified enhanced strain, and B-bar formulations - are turned off (default). - - - ``"OFF"`` - If element shapes are degenerated, regular - shape functions are still used, and the specified element - technologies (e.g., enhanced strain, B-bar, uniform - reduced integration) are still used. - - Notes - ----- - The command default is ``mapdl.etcontrol('SUGGESTION', 'ON')`` - - This command is valid for elements SHELL181, PLANE182, - PLANE183, SOLID185, SOLID186, SOLID187, BEAM188, BEAM189, - SHELL208, SHELL209, PLANE223, SOLID226, SOLID227, REINF264, - SOLID272, SOLID273, SHELL281, SOLID285, PIPE288, PIPE289, - ELBOW290. - - For more information, see Automatic Selection of Element - Technologies and Formulations in the Element Reference. - - Examples - -------- - Enable element tech control and degenerated shape control. - - >>> mapdl.et(1, 'SOLID186') - >>> output = mapdl.etcontrol(eltech='SET', eldegene='ON') - >>> print(output) - ELEMENT TECHNOLOGY CONTROL PARAMETER FOR APPLICABLE ELEMENTS = SET. - DEGENERATED ELEMENT SHAPE CONTROL PARAMETER FOR APPLICABLE ELEMENTS = ON. - """ - return self.run(f"ETCONTROL,{eltech},{eldegene}", **kwargs) - - def etdele( - self, - ityp1: Union[str, int] = "", - ityp2: MapdlInt = "", - inc: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """APDL Command: ETDELE - - Deletes element types. - - Parameters - ---------- - ityp1, ityp2, inc - Deletes element types from ``ityp1`` to ``ityp2`` - (defaults to ``ityp1``) in steps of ``inc`` (defaults to - 1). If ``ityp1='ALL'``, ``ityp2`` and ``inc`` are ignored - and all element types are deleted. Element types are - defined with the ``et`` command. - - Examples - -------- - Create and delete an element type. - - >>> mapdl.et(1, 'SOLID186') - >>> mapdl.etdele(1) - """ - command = f"ETDELE,{ityp1},{ityp2},{inc}" - return self.run(command, **kwargs) - - def etlist( - self, - ityp1: MapdlInt = "", - ityp2: MapdlInt = "", - inc: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Lists currently defined element types. - - APDL Command: ETLIST - - Parameters - ---------- - ityp1, ityp2, inc - Lists element types from ITYP1 to ITYP2 (defaults to - ITYP1) in steps of INC (defaults to 1). If ITYP1 = ALL ( - default), ITYP2 and INC are ignored and all element types - are listed. - - Notes - ----- - This command is valid in any processor. - """ - command = f"ETLIST,{ityp1},{ityp2},{inc}" - return self.run(command, **kwargs) - - def keyopt(self, itype="", knum="", value="", **kwargs): - """APDL Command: KEYOPT - - Sets element key options. - - Parameters - ---------- - itype - Element type number as defined on the ET command. The label GCN is - also valid input for general contact elements (see Notes). - - knum - Number of the KEYOPT to be defined (KEYOPT(KNUM)). - - value - Value of this KEYOPT. - - Notes - ----- - Alternative to inputting KEYOPT values on ET command. Must be used if - KEYOPT(7) or greater values are to be input. ITYPE must first be - defined with the ET command. - - Specify ITYPE = GCN to set element key options for all contact elements - types used in any existing general contact definitions (that is, - contact elements having a real constant set number = 0). - """ - command = "KEYOPT,%s,%s,%s" % (str(itype), str(knum), str(value)) - return self.run(command, **kwargs) - - def nsvr(self, itype="", nstv="", **kwargs): - """APDL Command: NSVR - - Defines the number of variables for user-programmable element options. - - Parameters - ---------- - itype - Element type number as defined on the ET command. - - nstv - Number of extra state variables to save (must be no more than 840). - - Notes - ----- - Defines the number of extra variables that need to be saved for user- - programmable (system-dependent) element options, e.g., material laws - through user subroutine USERPL. ITYPE must first be defined with the - ET command. - """ - command = "NSVR,%s,%s" % (str(itype), str(nstv)) - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/elements.py b/src/ansys/mapdl/core/_commands/preproc/elements.py deleted file mode 100644 index 56927e8f9ab..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/elements.py +++ /dev/null @@ -1,2636 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from typing import Optional, Union - -from ansys.mapdl.core._commands import parse -from ansys.mapdl.core.mapdl_types import MapdlFloat, MapdlInt - - -class Elements: - def afsurf(self, sarea="", tline="", **kwargs): - """Generates surface elements overlaid on the surface of existing solid elements. - - APDL Command: AFSURF - - This assigns extra nodes to the closest fluid element node. - - This command macro is used to generate surface effect elements overlaid - on the surface of existing solid elements and, based on proximity, to - determine and assign the extra node for each surface element. The - underlying volumes of the solid region and the fluid lines must be - meshed prior to calling this command macro. The active element type - must be SURF152 with appropriate settings for KEYOPT(4), KEYOPT(5), - KEYOPT(6), and KEYOPT(8). - - The surface areas of the solid and the target lines of the fluid are - grouped into components and named using the CM command. The names must - be enclosed in single quotes (e.g., 'SAREA') when the AFSURF command is - manually typed in. - - When using the GUI method, node and element components are created - through the picking dialog boxes associated with this command. - - The macro is applicable for the SURF152 and FLUID116 element types. - - Parameters - ---------- - sarea - Component name for the surface areas of the meshed solid volumes. - - tline - Component name for the target lines meshed with fluid elements. - """ - command = f"AFSURF,{sarea},{tline}" - return self.run(command, **kwargs) - - def e( - self, - i: MapdlInt = "", - j: MapdlInt = "", - k: MapdlInt = "", - l: MapdlInt = "", - m: MapdlInt = "", - n: MapdlInt = "", - o: MapdlInt = "", - p: MapdlInt = "", - **kwargs, - ) -> Optional[int]: - """Defines an element by node connectivity. - - APDL Command: E - - Defines an element by its nodes and attribute values. Up to 8 - nodes may be specified with the :meth:`e` command. If more nodes - are needed for the element, use the :meth:`emore` command. The - number of nodes required and the order in which they should be - specified are described in Chapter 4 of the Element Reference for - each element type. Elements are automatically assigned a number - [NUMSTR] as generated. The current (or default) MAT, TYPE, REAL, - SECNUM and ESYS attribute values are also assigned to the element. - - When creating elements with more than 8 nodes using this command - and the EMORE command, it may be necessary to turn off shape - checking using the SHPP command before issuing this command. If a - valid element type can be created without using the additional - nodes on the :meth:`emore` command, this command will create that - element. The :meth:`emore` command will then modify the element to - include the additional nodes. If shape checking is active, it will - be performed before the :meth:`emore` command is issued. - Therefore, if the shape checking limits are exceeded, element - creation may fail before the :meth:`emore` command modifies the - element into an acceptable shape. - - Parameters - ---------- - i - Number of node assigned to first nodal position (node - ``i``). - - j, k, l, m, n, o, p - Number assigned to second (node ``j``) through eighth - (node ``p``) nodal position, if any. - - Examples - -------- - Create a single SURF154 element. - - >>> mapdl.prep7() - >>> mapdl.et(1, 'SURF154') - >>> mapdl.n(1, 0, 0, 0) - >>> mapdl.n(2, 1, 0, 0) - >>> mapdl.n(3, 1, 1, 0) - >>> mapdl.n(4, 0, 1, 0) - >>> mapdl.e(1, 2, 3, 4) - 1 - - Create a single hexahedral SOLID185 element - - >>> mapdl.et(2, 'SOLID185') - >>> mapdl.type(2) - >>> mapdl.n(5, 0, 0, 0) - >>> mapdl.n(6, 1, 0, 0) - >>> mapdl.n(7, 1, 1, 0) - >>> mapdl.n(8, 0, 1, 0) - >>> mapdl.n(9, 0, 0, 1) - >>> mapdl.n(10, 1, 0, 1) - >>> mapdl.n(11, 1, 1, 1) - >>> mapdl.n(12, 0, 1, 1) - >>> mapdl.e(5, 6, 7, 8, 9, 10, 11, 12) - 2 - """ - command = f"E,{i},{j},{k},{l},{m},{n},{o},{p}" - return parse.parse_e(self.run(command, **kwargs)) - - def ecpchg(self, **kwargs): - """Optimizes degree-of-freedom usage in a coupled acoustic model. - - APDL Command: ECPCHG - - The ECPCHG command converts uncoupled acoustic element types to - coupled acoustic element types that are attached to the - fluid-structure interaction interface. Or it converts coupled - acoustic element types to uncoupled acoustic element types that - are not attached to the fluid-structure interaction - interface. Issuing ECPCHG can dramatically reduce the size of the - Jobname.EMAT file, compared to the model fully meshed with the - coupled acoustic elements. - - Performing the ECPCHG conversion on meshed volumes can create - circumstances in which more than one element type is defined for a - single volume. - - If the acoustic elements are coupled with shell elements (SHELL181 - or SHELL281), you must set the fluid-structure interaction (FSI) - flag by issuing the SF,,FSI command before the ECPCHG command. - - ECPCHG may add new element types to your model, or it may change - the element type for existing acoustic elements. You should verify - the defined element types with ETLIST and the element attributes - with ELIST after using this command. - """ - return self.run("ECPCHG", **kwargs) - - def edele( - self, - iel1: MapdlInt = "", - iel2: MapdlInt = "", - inc: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Deletes selected elements from the model. - - APDL Command: EDELE - - Deleted elements are replaced by null or "blank" - elements. Null elements are used only for retaining the - element numbers so that the element numbering sequence for the - rest of the model is not changed by deleting elements. Null - elements may be removed (although this is not necessary) with - the NUMCMP command. If related element data (pressures, etc.) - are also to be deleted, delete that data before deleting the - elements. EDELE is for unattached elements only. You can use - the xCLEAR family of commands to remove any attached elements - from the database. - - Parameters - ---------- - iel1, iel2, inc - Delete elements from ``iel1`` to ``iel2`` (defaults to - ``iel1``) in steps of ``inc`` (defaults to 1). If - ``iel1='ALL'``, ``iel2`` and ``inc`` are ignored and all - selected elements [ESEL] are deleted. A component name - may also be substituted for ``iel1`` (``iel2`` and ``inc`` - are ignored). - - Examples - -------- - Delete the elements 10 through 25 - - >>> mapdl.edele(10, 25) - 'DELETE SELECTED ELEMENTS FROM 10 TO 25 BY 1' - """ - return self.run(f"EDELE,{iel1},{iel2},{inc}", **kwargs) - - def eextrude( - self, - action="", - nelem="", - space="", - dist="", - theta="", - tfact="", - bckey="", - **kwargs, - ): - """Extrudes 2-D plane elements into 3-D solids. - - APDL Command: EEXTRUDE - - Parameters - ---------- - action - Specifies one of the following command behaviors: - - AUTO - Extrudes plane elements (PLANE182 and PLANE183) - based on the KEYOPT(3) setting. Complementary - elements are also extruded. (See Notes for more - information.) This behavior is the default. - - PLANE - Extrudes elements in the global Z - direction. KEYOPT(3) of the parent elements is - ignored. - - AXIS - Extrudes elements about the global Y - axis. KEYOPT(3) of the parent elements is ignored. - - TANGENT - Similar to Action = AXIS, except that target - elements are extruded in the global Z direction. - - nelem - Number of elements to generate in the extruded direction. If you do - not specify a number, the program calculates a number automatically - based on the average element size and extrusion distance. - - space - Spacing ratio. If positive, this value is the nominal - ratio of the last division size to the first division size - (if > 1.0, sizes increase, if < 1.0, sizes decrease). If - negative, ``|SPACE|`` is the nominal ratio of the center - division size to the end division size. The default value - is 1.0 (uniform spacing). - - dist - Distance to extrude in the global Z direction for the plane strain - case (Action = PLANE). The default is 1. - - theta - Ending angle (in degrees) to extrude about the global Y axis for - the axisymmetric case (Action = AXIS). The beginning angle is - always 0 degrees. The ending angle defaults to 360 degrees. - - tfact - Factor for increasing the rigid target size. The size of the - extruded rigid target elements is determined automatically based on - the size of the contact elements. The default value is 0.2. - - bckey - Controls the nodal orientation in the third direction and - boundary-condition mapping (Action = AXIS or TIRE only) - - * 0 : All nodes are rotated to a local Cartesian - coordinate system where X is the radial, Y axial and Z - circumferential direction. All loads and displacements - are mapped from the 2-D model to the 3-D model in the - local coordinate system. - - If applying rotation ROTY in axisymmetric cases with - torsion on the 2-D model, this value sets UZ = 0 at - all corresponding 3-D nodes. This value is the - default - - * 1 : Only nodes with applied loads and/or displacements - are rotated to a local Cartesian co- ordinate system - where X is the radial, Y axial and Z circumferential - direction. All loads are mapped to the 3-D model and - all applied displacements are reset to zero. - - Notes - ----- - The EEXTRUDE command extrudes current-technology elements PLANE182 and - PLANE183. Complementary elements TARGE169, CONTA171, CONTA172, and - REINF263 will also extrude. Extrusion operates automatically on - elements in the selected element set. - - For automatic PLANE182 and PLANE183 extrusion (Action = AUTO), based on - the element behavior of the plane elements, the command performs as - follows: - - Plane stress; the element is ignored. - - Axisymmetric; the element is extruded 360 degrees about the Y-axis. - THETA is ignored. - - Plane strain (Z strain = 0.0); the element is extruded a unit distance - in the global Z direction. - - Plane stress with thickness input; the element is extruded in the - Z-direction as specified by the thickness input via a real constant. - - Generalized plane strain; the element is ignored. - - For an axisymmetric extrusion (Action = AUTO with KEYOPT(3) = 1, Action - = AXIS, or Action = TANGENT), the command merges any nodes within the - specified tolerance (SELTOL,TOLER) of the axis into a single node, then - forms degenerate tetrahedrons, pyramids, or wedges. The default - tolerance value is 1.0E-6. - - When issuing the EEXTRUDE command within the MAP2DTO3D environment - using KEYOPT(3) = 3, mapping results do not provide the correct 3-D - results state; therefore, KEYOPT(3) = 3 is suggested only as a tool for - extruding the mesh itself as a geometric feature. - - For an axisymmetric extrusion, SHELL208 and SHELL209 will extrude. - - You can control shape-checking options via the SHPP command. - - The extrusion behavior of accompanying contact (CONTA171 and CONTA172) - is determined by the plane element settings. Rigid target (TARGE169) - elements are extruded in the global Z direction unless axisymmetric - extrusion (Action = AXIS) is in effect. - - The following table shows each 2-D element capable of extrusion and its - corresponding post-extrusion 3-D element: - - All element properties are also transferred consistently during - extrusion. For example, a 2-D element is extruded to a 3-D element, - and a mixed u-P 2-D element is extruded to a mixed u-P 3-D element. - """ - command = f"EEXTRUDE,{action},{nelem},{space},{dist},{theta},{tfact},,{bckey}" - return self.run(command, **kwargs) - - def egen( - self, - itime: MapdlInt = "", - ninc: MapdlInt = "", - iel1: Union[str, int] = "", - iel2: MapdlInt = "", - ieinc: MapdlInt = "", - minc: MapdlInt = "", - tinc: MapdlInt = "", - rinc: MapdlInt = "", - cinc: MapdlInt = "", - sinc: MapdlInt = "", - dx: MapdlFloat = "", - dy: MapdlFloat = "", - dz: MapdlFloat = "", - **kwargs, - ) -> Optional[str]: - """Generates elements from an existing pattern. - - APDL Command: EGEN - - Parameters - ---------- - itime, ninc - Do this generation operation a total of ITIMEs, - incrementing all nodes in the given pattern by NINC each - time after the first. ITIME must be >1 if generation is - to occur. NINC may be positive, zero, or negative. - If DX, DY, and/or DZ is specified, NINC should be set - so any existing nodes (as on NGEN) are not overwritten. - - iel1, iel2, ieinc - Generate elements from selected pattern beginning with - IEL1 to IEL2 (defaults to IEL1) in steps of IEINC ( - defaults to 1). If IEL1 is negative, IEL2 and IEINC are - ignored and the last \\|IEL1\\| elements - (in sequence backward from the maximum element number) - are used as the pattern to be repeated. If IEL1 = ALL, - IEL2 and IEINC are ignored and use all selected elements - [ESEL] as pattern to be repeated. A component name may - also be substituted for IEL1 (IEL2 and INC are - ignored). - - minc - Increment material number of all elements in the given - pattern by - MINC each time after the first. - - tinc - Increment type number by TINC. - - rinc - Increment real constant table number by RINC. - - cinc - Increment element coordinate system number by CINC. - - sinc - Increment section ID number by SINC. - - dx, dy, dz - Define nodes that do not already exist but are needed by - generated - elements (as though the NGEN,ITIME,INC,NODE1,,,DX,DY, - DZ were issued - before EGEN). Zero is a valid value. If blank, DX, DY, - and DZ are - ignored. - - Notes - ----- - A pattern may consist of any number of previously defined - elements. The MAT, TYPE, REAL, ESYS, and SECNUM numbers of - the new elements are based upon the elements in the pattern - and not upon the current specification settings. - - You can use the EGEN command to generate interface elements ( - INTER192, INTER193, INTER194, and INTER195) directly. - However, because interface elements require that the element - connectivity be started from the bottom surface, you must - make sure that you use the correct element node connectivity. - See the element descriptions for INTER192, INTER193, - INTER194, and INTER195 for the correct element node definition. - """ - command = ( - f"EGEN,{itime},{ninc},{iel1},{iel2},{ieinc},{minc}," - f"{tinc},{rinc},{cinc},{sinc},{dx},{dy},{dz}" - ) - return self.run(command, **kwargs) - - def einfin( - self, compname: str = "", pnode: MapdlInt = "", **kwargs - ) -> Optional[str]: - """Generates structural infinite elements from selected nodes. - - APDL Command: EINFIN - - Parameters - ---------- - compname - Component name containing one node to be used as the pole - node for generating INFIN257 structural infinite - elements. The pole node is generally located at or near - the geometric center of the finite element domain. - - pnode - Node number for the direct input of the pole node. A - parameter or parametric expression is also valid. Specify - this value when no CompName has been specified. If - CompName is specified, this value is ignored. - - Notes - ----- - The EINFIN command generates structural infinite elements - (INFIN257) directly from the selected face of valid base - elements (existing standard elements in your model). The - command scans all base elements for the selected nodes and - generates a compatible infinite element type for each base - element. A combination of different base element types is - allowed if the types are all compatible with the infinite - elements. - - The infinite element type requires no predefinition (ET). - - The faces of base elements are determined from the selected - node set (NSEL), and the geometry of the infinite element is - determined based on the shape of the face. Element - characteristics and options are determined according to the - base element. For the face to be used, all nodes on the face - of a base element must be selected - - Use base elements to model the near-field domain that - interacts with the solid structures or applied loads. To - apply the truncated far-field effect, a single layer of - infinite elements must be attached to the near-field domain. - The outer surface of the near-field domain - must be convex. - - After the EINFIN command executes, you can verify the newly - created infinite element types and elements (ETLIST, ELIST, - EPLOT). - - Infinite elements do not account for any subsequent - modifications made to the base elements. It is good practice - to issue the EINFIN - command only after the base elements are finalized. If you - delete or modify base elements, remove all affected infinite - elements and reissue the EINFIN command; doing so prevents - inconsistencies. - """ - command = f"EINFIN,{compname},{pnode}" - return self.run(command, **kwargs) - - def eintf( - self, - toler: MapdlFloat = "", - k: MapdlInt = "", - tlab: str = "", - kcn: str = "", - dx: MapdlFloat = "", - dy: MapdlFloat = "", - dz: MapdlFloat = "", - knonrot: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Defines two-node elements between coincident or offset nodes. - - APDL Command: EINTF - - Parameters - ---------- - toler - Tolerance for coincidence (based on maximum Cartesian - coordinate difference for node locations and on angle - differences for node orientations). Defaults to 0.0001. - Only nodes within the tolerance are considered to be - coincident. - - k - Only used when the type of the elements to be generated is - PRETS179. K is the pretension node that is common to the - pretension section that is being created. If K is not - specified, it will be created by ANSYS automatically and - will have an ANSYS-assigned node number. If K is - specified but does not already exist, it will be - created automatically but will have the user-specified - node number. K cannot be connected to any existing element. - - tlab - Nodal number ordering. Allowable values are: - - LOW - The 2-node elements are generated from the lowest - numbered node to the highest numbered node. - - HIGH - The 2-node elements are generated from the highest - numbered node to the lowest numbered node. - - REVE - Reverses the orientation of the selected 2-node - element. - - kcn - In coordinate system KCN, elements are created between - node 1 and node 2 (= node 1 + dx dy dz). - - dx, dy, dz - Node location increments that define the node offset in - the active coordinate system (DR, Dθ, DZ for cylindrical - and DR, Dθ, DΦ for spherical or toroidal). - - knonrot - When KNONROT = 0, the nodes coordinate system is not - rotated. When KNONROT = 1, the nodes belonging to the - elements created are rotated into coordinate system KCN - (see NROTAT command description). - - Notes - ----- - Defines 2-node elements (such as gap elements) between - coincident or offset nodes (within a tolerance). May be used, - for example, to "hook" together elements interfacing at a - seam, where the seam consists of a series of node pairs. One - element is generated for each set of two coincident nodes. - For more than two coincident or offset nodes in a cluster, - an element is generated from the lowest numbered - node to each of the other nodes in the cluster. If fewer than - all nodes are to be checked for coincidence, use the NSEL - command to select the nodes. Element numbers are incremented - by one from the highest previous element number. The element - type must be set [ET] to a 2-node element before issuing this - command. Use the CPINTF command to connect nodes by - coupling instead of by elements. Use the CEINTF command to - connect the nodes by constraint equations instead of by - elements. - - For contact element CONTA178, the tolerance is based on the - maximum Cartesian coordinate difference for node locations - only. The angle differences for node orientations are not - checked. - """ - command = f"EINTF,{toler},{k},{tlab}," f"{kcn},{dx},{dy}," f"{dz},{knonrot}" - return self.run(command, **kwargs) - - def elist( - self, - iel1: Union[str, int] = "", - iel2: MapdlInt = "", - inc: MapdlInt = "", - nnkey: MapdlInt = "", - rkey: MapdlInt = "", - ptkey: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Lists the elements and their attributes. - - APDL Command: ELIST - - Parameters - ---------- - iel1, iel2, inc - Lists elements from IEL1 to IEL2 (defaults to IEL1) in - steps of INC (defaults to 1). If IEL1 = ALL (default), - IEL2 and INC are ignored and all selected elements [ESEL] - are listed. A component name may also be substituted - for IEL1 (IEL2 and INC are ignored). - - nnkey - Node listing key: - - 0 - List attribute references and nodes. - - 1 - List attribute references but not nodes. - - rkey - Real constant listing key: - - 0 - Do not show real constants for each element. - - 1 - Show real constants for each element. This includes - default values chosen for - the element. - - ptkey - LS-DYNA part number listing key (applicable to ANSYS - LS-DYNA only): - - 0 - Do not show part ID number for each element. - - 1 - Show part ID number for each element. - - Notes - ----- - Lists the elements with their nodes and attributes (MAT, - TYPE, REAL, ESYS, SECNUM, PART). See also the LAYLIST command - for listing layered elements. - - This command is valid in any processor. - """ - command = f"ELIST,{iel1},{iel2},{inc},{nnkey},{rkey},{ptkey}" - return self.run(command, **kwargs) - - def emid(self, key="", edges="", **kwargs): - """Adds or removes midside nodes. - - APDL Command: EMID - - Parameters - ---------- - key - Add or remove key: - - ADD - Add midside node to elements (default). - - REMOVE - Remove midside nodes from elements. - - edges - ALL - - ALL - Add (or remove) midside nodes to (from) all edges of all selected elements, - independent of which nodes are selected (default). - - EITHER - Add (or remove) midside nodes only to (from) element edges which have either - corner node selected. - - BOTH - Add (or remove) midside nodes only to (from) element edges which have both - corner nodes selected. - - Notes - ----- - This command adds midside nodes to (or removes midside nodes from) the - selected elements. For this to occur, the selected elements must be - midside node capable, the active element type [TYPE] must allow midside - node capability, and the relationship between the finite element model - and the solid model (if any) must first be disassociated [MODMSH]. - - By default, EMID generates a midside node wherever a zero (or missing) - midside node occurs for that element. You can control this and add (or - remove) midside nodes selectively by using the Edges argument. Nodes - are located midway between the two appropriate corner nodes based on a - linear Cartesian interpolation. Nodal coordinate system rotation angles - are also linearly interpolated. Connected elements share the same - midside node. Node numbers are generated sequentially from the maximum - node number. - - The EMID command is useful for transforming linear element types to - quadratic element types having the same corner node connectivity. - - EMID is also useful for transforming elements created outside of the - program. - """ - command = f"EMID,{key},{edges}" - return self.run(command, **kwargs) - - def emodif( - self, - iel: Union[str, int] = "", - stloc: Union[str, int] = "", - i1: MapdlInt = "", - i2: MapdlInt = "", - i3: MapdlInt = "", - i4: MapdlInt = "", - i5: MapdlInt = "", - i6: MapdlInt = "", - i7: MapdlInt = "", - i8: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Modifies a previously defined element. - - APDL Command: EMODIF - - Parameters - ---------- - iel - Modify nodes and/or attributes for element number IEL. If - ALL, modify all selected elements [ESEL]. A component name - may also be substituted for IEL. - - stloc - Starting location (n) of first node to be modified or the - attribute label. - - i1, i2, i3, i4, i5, i6, i7, i8 - Replace the previous node numbers assigned to this element - with these corresponding values. A (blank) retains the - previous value (except in the I1 field, which resets the - STLOC node number to zero). - - Notes - ----- - The nodes and/or attributes (MAT, TYPE, REAL, ESYS, and SECNUM - values) of an existing element may be changed with this - command. - - Examples - -------- - Modify all elements to have a material number of 2. - - >>> mapdl.clear() - >>> mapdl.prep7() - >>> mp_num = 2 - >>> mapdl.mp('EX', mp_num, 210E9) - >>> mapdl.mp('DENS', mp_num, 7800) - >>> mapdl.mp('NUXY', mp_num, 0.3) - >>> mapdl.block(0, 1, 0, 1, 0, 1) - >>> mapdl.et(1, 'SOLID186') - >>> mapdl.vmesh('ALL') - >>> mapdl.emodif('ALL', 'MAT', i1=mp_num) - 'MODIFY ALL SELECTED ELEMENTS TO HAVE MAT = 2' - - Use `emodif` to modify all of volume 2's elements - after meshing. - - >>> mapdl.vmesh('S', 'VOLU', '', 2) - >>> mapdl.allsel('BELOW', 'VOLU') - >>> mapdl.emodif('ALL', 'MAT', 2) - """ - command = f"EMODIF,{iel},{stloc},{i1},{i2},{i3},{i4},{i5},{i6},{i7},{i8}" - return self.run(command, **kwargs) - - def emore( - self, - q: MapdlInt = "", - r: MapdlInt = "", - s: MapdlInt = "", - t: MapdlInt = "", - u: MapdlInt = "", - v: MapdlInt = "", - w: MapdlInt = "", - x: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Add more nodes to the just-defined element. - - APDL Command: EMORE - - Repeat this method for up to 4 additional nodes (20 - maximum). Nodes are added after the last nonzero node of the - element. Node numbers defined with this command may be - zeroes. - - Parameters - ---------- - q, r, s, t, u, v, w, x - Numbers of nodes typically assigned to ninth (node Q) - through sixteenth (node X) nodal positions, if any. - - Examples - -------- - Generate a single quadratic element. - - >>> mapdl.prep7() - >>> mapdl.et(1, 'SOLID186') - >>> mapdl.n(1, -1, -1, -1) - >>> mapdl.n(2, 1, -1, -1) - >>> mapdl.n(3, 1, 1, -1) - >>> mapdl.n(4, -1, 1, -1) - >>> mapdl.n(5, -1, -1, 1) - >>> mapdl.n(6, 1, -1, 1) - >>> mapdl.n(7, 1, 1, 1) - >>> mapdl.n(8, -1, 1, 1) - >>> mapdl.n(9, 0, -1, -1) - >>> mapdl.n(10, 1, 0, -1) - >>> mapdl.n(11, 0, 1, -1) - >>> mapdl.n(12, -1, 0, -1) - >>> mapdl.n(13, 0, -1, 1) - >>> mapdl.n(14, 1, 0, 1) - >>> mapdl.n(15, 0, 1, 1) - >>> mapdl.n(16, -1, 0, 1) - >>> mapdl.n(17, -1, -1, 0) - >>> mapdl.n(18, 1, -1, 0) - >>> mapdl.n(19, 1, 1, 0) - >>> mapdl.n(20, -1, 1, 0) - >>> mapdl.e(1, 2, 3, 4, 5, 6, 7, 8) - >>> mapdl.emore(9, 10, 11, 12, 13, 14, 15, 16) - >>> output = mapdl.emore(17, 18, 19, 20) - 'ELEMENT 1 1 2 3 4 5 6 7 8 - 9 10 11 12 13 14 15 16 - 17 18 19 20 - """ - command = f"EMORE,{q},{r},{s},{t},{u},{v},{w},{x}" - return self.run(command, **kwargs) - - def emtgen( - self, - ncomp="", - ecomp="", - pncomp="", - dof="", - gap="", - gapmin="", - fkn="", - epzero="", - **kwargs, - ): - """Generates a set of TRANS126 elements. - - APDL Command: EMTGEN - - Parameters - ---------- - ncomp - Component name of the surface nodes of a structure which attach to - the TRANS126 elements. You must enclose name-strings in single - quotes in the EMTGEN command line. - - ecomp - Component name of the TRANS126 elements generated. You must - enclose name-strings in single quotes in the EMTGEN command line. - Defaults to EMTELM. - - pncomp - Component name of the plane nodes generated by the command at an - offset (GAP) from the surface nodes. You must enclose name-strings - in single quotes in the EMTGEN command line. Defaults to EMTPNO. - - dof - Active structural degree of freedom (DOF) for TRANS126 elements - (UX, UY, or UZ) in the Cartesian coordinate system. You must - enclose the DOF in single quotes. - - gap - Initial gap distance from the surface nodes to the plane. Be sure - to use the correct sign with respect to Ncomp node location. - - gapmin - Minimum gap distance allowed (GAPMIN real constant) for TRANS126 - elements. Defaults to the absolute value of (GAP)*0.05. - - fkn - Contact stiffness factor used as a multiplier for a contact - stiffness appropriate for bulk deformation. Defaults to 0.1. - - epzero - Free-space permittivity. Defaults to 8.854e-6 (μMKS units). - - Notes - ----- - The EMTGEN command generates a set of TRANS126 elements between the - surface nodes of a moveable structure and a plane of nodes, typically - representing a ground plane. The plane of nodes are created by the - command at a specified offset (GAP). Each element attaches to a surface - node and to a corresponding node representing the plane. The created - elements are set to the augmented stiffness method (KEYOPT(6) = 1), - which can help convergence. The generated plane nodes should be - constrained appropriately for the analysis. - - You can use TRANS126 elements for simulating fully coupled - electrostatic structural coupling between a MEMS device and a plane, if - the gap distance between the device and the plane is small compared to - the overall surface area dimensions of the device. This assumption - allows for a point-wise closed-form solution of capacitance between the - surface nodes and the plane; i.e. CAP = ``EPZERO*AREA/GAP``, where EPZERO - if the free-space permittivity, AREA is the area associated with the - node, and GAP is the gap between the node and the plane. The area for - each node is computed using the ARNODE function in ANSYS. See the ``*GET`` - command description for more information on the ARNODE function. - - With a distributed set of TRANS126 elements attached directly to the - structure and a plane (such as a ground plane), you can perform a full - range of coupled electrostatic-structural simulations, including: - - Static analysis (due to a DC voltage or a mechanical load) - - Prestressed modal analysis (eigenfrequencies, including frequency-shift - effects of a DC bias voltage) - - Prestressed harmonic analysis (system response to a small-signal AC - excitation with a DC bias voltage or mechanical load) - - Large signal transient analysis (time-transient solution due to an - arbitrary time-varying voltage or mechanical excitation) - - The TRANS126 element also employs a node-to-node gap feature so you can - perform contact-type simulations where the structure contacts a plane - (such as a ground plane). The contact stiffness factor, FKN, is used to - control contact penetration once contact is initiated. A smaller value - provides for easier convergence, but with more penetration. - """ - command = f"EMTGEN,{ncomp},{ecomp},{pncomp},{dof},{gap},{gapmin},{fkn},{epzero}" - return self.run(command, **kwargs) - - def en( - self, - iel: MapdlInt = "", - i: MapdlInt = "", - j: MapdlInt = "", - k: MapdlInt = "", - l: MapdlInt = "", - m: MapdlInt = "", - n: MapdlInt = "", - o: MapdlInt = "", - p: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Defines an element by its number and node connectivity. - - APDL Command: EN - - Parameters - ---------- - iel - Number assigned to element being defined. - - i - Number of node assigned to first nodal position (node I). - - j, k, l, m, n, o, p - Number assigned to second (node J) through eighth (node - P) nodal position, if any. - - Notes - ----- - Defines an element by its nodes and attribute values. Similar - to the E command except it allows the element number (IEL) to be defined - explicitly. Element numbers need not be consecutive. Any - existing element already having this number will be redefined. - - Up to 8 nodes may be specified with the EN command. If more - nodes are needed for the element, use the - :meth:`emore` command. The number of nodes required and the - order in which they should be specified are described in the - Element Reference for each element type. The current (or - default) MAT, TYPE, REAL, SECNUM, and ESYS attribute values - are also assigned to the element. - - When creating elements with more than 8 nodes using this - command and the :meth:`emore` command, it may be necessary to - turn off shape checking using the SHPP command before - issuing this command. If a valid element type can be created - without using the additional nodes on the :meth:`emore` - command, this command will create that element. The - :meth:`emore` command will then modify the element to include - the additional nodes. If shape checking is active, it will be - performed before the :meth:`emore` command is issued. - Therefore, if the shape checking limits are exceeded, element - creation may fail before the :meth:`emore` command modifies - the element into an acceptable shape. - """ - command = f"EN,{iel},{i},{j},{k},{l},{m},{n},{o},{p}" - return self.run(command, **kwargs) - - def endrelease(self, tolerance="", dof1="", dof2="", dof3="", dof4="", **kwargs): - """Specifies degrees of freedom to be decoupled for end release. - - APDL Command: ENDRELEASE - - Parameters - ---------- - tolerance - Angle tolerance (in degrees) between adjacent elements. Defaults to - 20°. Set TOLERANCE to -1 to indicate all selected elements. - - dof1, dof2, dof3, dof4 - Degrees of freedom to release. If Dof1 is blank, WARP is assumed - and Dof2, Dof3, and Dof4 are ignored. - - WARP - Release the warping degree of freedom (default). - - ROTX - Release rotations in the X direction. - - ROTY - Release rotations in the Y direction. - - ROTZ - Release rotations in the Z direction. - - UX - Release displacements in the X direction. - - UY - Release displacements in the Y direction. - - UZ - Release displacements in the Z direction. - - BALL - Create ball joints (equivalent to releasing WARP, - ROTX, ROTY, and ROTZ). - - Notes - ----- - This command specifies end releases for the BEAM188, BEAM189, PIPE288, - and PIPE289 elements. The command works on currently selected nodes and - elements. It creates end releases on any two connected beam elements - whose angle at connection exceeds the specified tolerance. From within - the GUI, the Picked node option generates an end release at the - selected node regardless of the angle of connection (angle tolerance is - set to -1). - - Use the CPLIST command to list the coupled sets generated by the - ENDRELEASE command. - - Note:: : You should exercise due engineering judgement when using this - command, as improper use may result in mechanics that render a solution - impossible. - """ - command = f"ENDRELEASE,,{tolerance},{dof1},{dof2},{dof3},{dof4}" - return self.run(command, **kwargs) - - def engen( - self, - iinc: MapdlInt = "", - itime: MapdlInt = "", - ninc: MapdlInt = "", - iel1: MapdlInt = "", - iel2: MapdlInt = "", - ieinc: MapdlInt = "", - minc: MapdlInt = "", - tinc: MapdlInt = "", - rinc: MapdlFloat = "", - cinc: MapdlInt = "", - sinc: MapdlInt = "", - dx: MapdlInt = "", - dy: MapdlInt = "", - dz: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Generates elements from an existing pattern. - - APDL Command: ENGEN - - Parameters - ---------- - iinc - Increment to be added to element numbers in pattern. - - itime, ninc - Do this generation operation a total of ITIMEs, - incrementing all nodes in the given pattern by NINC each - time after the first. ITIME must be > 1 if generation is - to occur. NINC may be positive, zero, or negative. - - iel1, iel2, ieinc - Generate elements from the pattern that begins with IEL1 - to IEL2 (defaults to IEL1) in steps of IEINC (defaults to - 1). If IEL1 is negative, IEL2 and IEINC are ignored and - use the last \\|IEL1\\| elements (in sequence backward from - the maximum element number) as the pattern to be - repeated. If IEL1 = ALL, IEL2 and IEINC are ignored and - all selected elements [ESEL] are used as the - pattern to be repeated. A component name may also be - substituted for IEL1 (IEL2 and IEINC are ignored). - - minc - Increment material number of all elements in the given - pattern by MINC each time after the first. - - tinc - Increment type number by TINC. - - rinc - Increment real constant table number by RINC. - - cinc - Increment element coordinate system number by CINC. - - sinc - Increment section ID number by SINC. - - dx, dy, dz - Define nodes that do not already exist but are needed by - generated elements (NGEN,ITIME,INC,NODE1,,,DX,DY, - DZ). Zero is a valid value. If blank, DX, DY, and DZ are - ignored. - - Notes - ----- - Same as the EGEN command except it allows element numbers to be - explicitly incremented (IINC) from the generated set. Any - existing elements already having these numbers will be - redefined. - """ - command = ( - f"ENGEN,{iinc},{itime},{ninc},{iel1},{iel2}," - f"{ieinc},{minc},{tinc},{rinc},{cinc},{sinc},{dx}," - f"{dy},{dz}" - ) - return self.run(command, **kwargs) - - def enorm(self, enum: Union[str, int] = "", **kwargs) -> Optional[str]: - """Reorients shell element normals or line element node connectivity. - - APDL Command: ENORM - - Parameters - ---------- - enum - Element number having the normal direction that the - reoriented elements are to match. - - Notes - ----- - Reorients shell elements so that their outward normals are - consistent with that of a specified element. ENORM can also be - used to reorder nodal connectivity of line elements so that - their nodal ordering is consistent with that of a specified - element. - - For shell elements, the operation reorients the element by - reversing and shifting the node connectivity pattern. For - example, for a 4-node shell element, the nodes in positions I, - J, K and L of the original element are placed in positions J, - I, L and K of the reoriented element. All 3-D shell elements - in the selected set are considered for reorientation, and no - element is reoriented more than once during the - operation. Only shell elements adjacent to the lateral (side) - faces are considered. - - The command reorients the shell element normals on the same - panel as the specified shell element. A panel is the geometry - defined by a subset of shell elements bounded by free edges or - T-junctions (anywhere three or more shell edges share common - nodes). - - Reorientation progresses within the selected set until either - of the following conditions is true: - - - The edge of the model is reached. - - - More than two elements (whether selected or unselected) are - adjacent to a lateral face. - - In situations where unselected elements might undesirably - cause case b to control, consider using ENSYM,0,,0,ALL instead - of ENORM. It is recommended that reoriented elements be - displayed and graphically reviewed. - - You cannot use the ENORM command to change the normal - direction of any element that has a body or surface load. We - recommend that you apply all of your loads only after ensuring - that the element normal directions are acceptable. - - Real constant values are not reoriented and may be invalidated - by an element reversal. - - Examples - -------- - >>> mapdl.enorm(1) - """ - return self.run(f"ENORM,{enum}", **kwargs) - - def ensym( - self, - iinc: MapdlInt = "", - ninc: MapdlInt = "", - iel1: MapdlInt = "", - iel2: MapdlInt = "", - ieinc: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Generates elements by symmetry reflection. - - APDL Command: ENSYM - - Parameters - ---------- - iinc - Increment to be added to element numbers in existing set. - - ninc - Increment nodes in the given pattern by NINC. - - iel1, iel2, ieinc - Reflect elements from pattern beginning with IEL1 to IEL2 - (defaults to IEL1) in steps of IEINC (defaults to 1). If - IEL1 = ALL, IEL2 and IEINC are ignored and pattern is all - selected elements [ESEL]. A component name may also be - substituted for IEL1 (IEL2 and IEINC are ignored). - - Notes - ----- - This command is the same as the ESYM command except it allows - explicitly assigning element numbers to the generated set (in - terms of an increment IINC). Any existing elements already - having these numbers will be redefined. - - The operation generates a new element by incrementing the - nodes on the original element, and reversing and shifting the - node connectivity pattern. For example, for a 4-node 2-D - element, the nodes in positions I, J, K and L of the original - element are placed in positions J, I, L and K of the reflected - element. - - Similar permutations occur for all other element types. For - line elements, the nodes in positions I and J of the original - element are placed in positions J and I of the reflected - element. In releases prior to ANSYS 5.5, no node pattern - reversing and shifting occurred for line elements generated by - ENSYM. To achieve the same results as you did in releases - prior to ANSYS 5.5, use the ENGEN command instead. - - See the ESYM command for additional information about symmetry - elements. - - The ENSYM command also provides a convenient way to reverse - shell element normals. If the IINC and NINC argument fields - are left blank, the effect of the reflection is to reverse the - direction of the outward normal of the specified elements. You - cannot use the ENSYM command to change the normal direction of - any element that has a body or surface load. We recommend that - you apply all of your loads only after ensuring that the - element normal directions are acceptable. Also note that real - constants (such as nonuniform shell thickness and tapered beam - constants) may be invalidated by an element reversal. See - Revising Your Model in the Modeling and Meshing Guide for more - information about controlling element normals. - """ - return self.run(f"ENSYM,{iinc},,{ninc},{iel1},{iel2},{ieinc}", **kwargs) - - def eplot(self, **kwargs): - """Plots the currently selected elements. - - APDL Command: EPLOT - - Notes - ----- - Produces an element display of the selected elements. In full - graphics, only those elements faces with all of their corresponding - nodes selected are plotted. In PowerGraphics, all element faces of the selected - element set are plotted irrespective of the nodes selected. However, - for both full graphics and Power Graphics, adjacent or otherwise - duplicated faces of 3-D solid elements will not be displayed in an attempt - to eliminate plotting of interior facets. See the ``DSYS`` command for display - coordinate system issues. - This command will display curvature in midside node elements when PowerGraphics is activated - [``/GRAPHICS ,POWER``] and ``/EFACET,2`` or ``/EFACET,4`` are enabled. (To display - curvature, two facets per edge is recommended [``/EFACET,2``]). When you specify ``/EFACET,1``, - PowerGraphics does not display midside nodes. ``/EFACET`` has no effect on EPLOT for non-midside - node elements. - This command is valid in any processor. - """ - return self.run("EPLOT", **kwargs) - - def eread(self, fname: str = "", ext: str = "", **kwargs) -> Optional[str]: - """Reads elements from a file. - - APDL Command: EREAD - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, - including the characters needed for the directory path). - An unspecified directory path defaults to the working - directory; in this case, you can use all 248 characters - for the file name. - - ext - Filename extension (eight-character maximum). - - Notes - ----- - This read operation is not necessary in a standard ANSYS run - but is provided as a convenience to users wanting to read a - coded element file, such as from another mesh generator or - from a CAD/CAM program. Data should be formatted as produced - with the EWRITE command. If issuing EREAD to acquire element - information generated from ANSYS EWRITE, you must also issue - NREAD before the EREAD command. The element types [ET] must be - defined before the file is read so that the file may be read - properly. Only elements that are specified with the ERRANG - command are read from the file. Also, only elements that are - fully attached to the nodes specified on the NRRANG command - are read from the file. Elements are assigned numbers - consecutively as read from the file, beginning with the - current highest database element number plus one. The file is - rewound before and after reading. Reading continues until the - end of the file. - """ - command = f"EREAD,{fname},{ext}" - return self.run(command, **kwargs) - - def ereinf(self, **kwargs) -> Optional[str]: - """Generates reinforcing elements from selected existing (base) elements. - - APDL Command: EREINF - - Notes - ----- - The EREINF command generates reinforcing elements (REINF264 and - REINF265) directly from selected base elements (that is, - existing standard elements in your model). The command scans all - selected base elements and generates (if necessary) a compatible - reinforcing element type for each base element. (ANSYS - allows a combination of different base element types.) - - Although predefining the reinforcing element type (ET) is not - required, you must define the reinforcing element section type - (SECTYPE); otherwise, ANSYS cannot generate the - reinforcing element. - - The EREINF command does not create new nodes. The reinforcing - elements and the base elements share the common nodes. - - Elements generated by this command are not associated with - the solid model. - - After the EREINF command executes, you can issue ETLIST, ELIST, - and EPLOT commands to verify the newly created reinforcing - element types and elements. - - Reinforcing elements do not account for any subsequent - modifications made to the base elements. ANSYS, - Inc. recommends issuing the EREINF command only after the - base elements are finalized. If you delete or modify base - elements (via EDELE, EMODIF, ETCHG, EMID, EORIENT, NUMMRG, - or NUMCMP commands, for example), remove all affected - reinforcing elements and reissue the EREINF command to avoid - inconsistencies. - """ - command = f"EREINF," - return self.run(command, **kwargs) - - def errang( - self, - emin: MapdlInt = "", - emax: MapdlInt = "", - einc: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Specifies the element range to be read from a file. - - APDL Command: ERRANG - - Parameters - ---------- - emin, emax, einc - Elements with numbers from EMIN (defaults to 1) to EMAX - (defaults to 99999999) in steps of EINC (defaults to 1) - will be read. - - Notes - ----- - Defines the element number range to be read [EREAD] from the - element file. If a range is also implied from the NRRANG - command, only those elements satisfying both ranges will be - read. - """ - command = f"ERRANG,{emin},{emax},{einc}" - return self.run(command, **kwargs) - - def esurf( - self, xnode: MapdlInt = "", tlab: str = "", shape: str = "", **kwargs - ) -> Optional[str]: - """Generates elements overlaid on the free faces of selected nodes. - - APDL Command: ESURF - - Parameters - ---------- - xnode - Node number that is used only in the following two cases: - - tlab - Generates target, contact, and hydrostatic fluid elements - with correct direction of normals. - - TOP - Generates target and contact elements over beam and - shell elements, or hydrostatic fluid elements over - shell elements, with the normals the same as the - underlying beam and shell elements (default). - - BOTTOM - Generates target and contact elements over beam - and shell elements, or hydrostatic fluid - elements over shell elements, with the - normals opposite to the underlying beam and shell - elements. - - If target or contact elements and hydrostatic fluid - elements are defined on the same underlying shell - elements, you only need to use this option once to orient - the normals opposite to the - underlying shell elements. - - REVERSE - Reverses the direction of the normals on - existing selected target elements, contact - elements, and hydrostatic fluid elements. - If - target or contact elements and hydrostatic - fluid elements are defined on the same - underlying shell elements, you only need to use - this option once to reverse the normals for all - selected elements. - - shape - Used to specify the element shape for target element - TARGE170 (Shape = LINE or POINT) or TARGE169 elements - (Shape = POINT). - - (blank) - The target element takes the same shape as the - external surface of the underlying element - (default). - - LINE - Generates LINE or PARA (parabolic) segments on - exterior of selected 3-D elements. - - POINT - Generates POINT segments on selected nodes. - - Notes - ----- - The ESURF command generates elements of the currently active - element type overlaid on the free faces of existing elements. - For example, surface elements (such as SURF151, SURF152, - SURF153, SURF154, or SURF159) can be generated over solid - elements (such as PLANE55, SOLID70, PLANE182, SOLID185, - or SOLID272, respectively). - - Element faces are determined from the selected node set - (NSEL) and the load faces for that element type. The - operation is similar to that used for generating element - loads from selected nodes via the SF,ALL command, except that - elements (instead of loads) are generated. All nodes on the - face must be selected for the face to be used. For shell - elements, only face one of the element is available. If nodes - are shared by adjacent selected element faces, the faces are not - free and no element is generated. - - Elements created by ESURF are oriented such that their - surface load directions are consistent with those of the - underlying elements. Carefully check generated elements and - their orientations. - - Generated elements use the existing nodes and the active MAT, - TYPE, REAL, and ESYS attributes. The exception is when Tlab = - REVERSE. The reversed target and contact elements have the - same attributes as the original elements. If the underlying - elements are solid elements, Tlab = TOP or BOTTOM has no effect. - - When the command generates a target element, the shape is by - default the same as that of the underlying element. Issue - ESURF,,, LINE or ESURF,,,POINT to generate LINE, PARA, - and POINT segments. - - The ESURF command can also generate the 2-D or 3-D - node-to-surface element CONTA175, based on the selected node - components of the underlying solid elements. When used to - generate CONTA175 elements, all ESURF arguments are ignored. - (If CONTA175 is the active element type, the path Main Menu> - Preprocessor> Modeling> Create> Elements> Node-to-Surf uses - ESURF to generate elements.) - - To generate SURF151 or SURF152 elements that have two extra - nodes from FLUID116 elements, KEYOPT(5) for SURF151 or - SURF152 is first set to 0 and ESURF is issued. Then KEYOPT(5) - for SURF151 or SURF152 is set to 2 and MSTOLE is issued. For - more information, see Using the Surface Effect Elements in - the Thermal Analysis Guide. - - For hydrostatic fluid elements HSFLD241 and HSFLD242, - the ESURF command generates triangular (2-D) or - pyramid-shaped (3-D) elements with bases that are overlaid on - the faces of selected 2-D or 3-D solid or shell elements. - The single vertex for all generated elements is at the - pressure node specified as XNODE. The generated elements fill - the volume enclosed by the solid or shell elements. The nodes - on the overlaid faces have translational degrees of freedom, - while the pressure node shared by all generated elements has - a single hydrostatic pressure degree of freedom, HDSP (see - HSFLD241 and HSFLD242 for more information about the pressure - node). - """ - command = f"ESURF,{xnode},{tlab},{shape}" - return self.run(command, **kwargs) - - def esym( - self, - ninc: MapdlInt = "", - iel1: MapdlInt = "", - iel2: MapdlInt = "", - ieinc: MapdlInt = "", - **kwargs, - ) -> Optional[str]: - """Generates elements from a pattern by a symmetry reflection. - - APDL Command: ESYM - - Parameters - ---------- - ninc - Increment nodes in the given pattern by NINC. - - iel1, iel2, ieinc - Reflect elements from pattern beginning with IEL1 to IEL2 - (defaults to IEL1) in steps of IEINC (defaults to 1). If - IEL1 = ALL, IEL2 and IEINC are ignored and pattern is all - selected elements [ESEL]. A component name may - also be substituted for IEL1 (IEL2 and IEINC are ignored). - - Notes - ----- - Generates additional elements from a given pattern (similar - to EGEN) except with a "symmetry" reflection. The operation - generates a new element by incrementing the nodes on the - original element, and reversing and shifting the node - connectivity pattern. For example, for a 4-node 2-D element, - the nodes in positions I, J, K, and L of the original element - are placed in positions J, I, L, and K of the reflected element. - - Similar permutations occur for all other element types. For line - elements, the nodes in positions I and J of the original - element are placed in positions J and I of the reflected - element. In releases prior - to ANSYS 5.5, no node pattern reversing and shifting occurred - for line elements generated by ESYM. To achieve the same - results with ANSYS 5.5 as you did in prior releases, use the - EGEN command instead. - - It is recommended that symmetry elements be displayed and - graphically reviewed. - - If the nodes are also reflected (as with the NSYM command) - this pattern is such that the orientation of the symmetry - element remains similar to the original element (i.e., - clockwise elements are generated from - clockwise elements). - - For a non-reflected node pattern, the reversed orientation - has the effect of reversing the outward normal direction ( - clockwise elements are generated from counterclockwise - elements). - - Note:: : Since nodes may be defined anywhere in the model - independently of this command, any orientation of the - "symmetry" elements is possible. See also the ENSYM command - for modifying existing elements. - """ - return self.run(f"ESYM,,{ninc},{iel1},{iel2},{ieinc}", **kwargs) - - def ewrite( - self, - fname: str = "", - ext: str = "", - kappnd: MapdlInt = "", - format_: str = "", - **kwargs, - ) -> Optional[str]: - """Writes elements to a file. - - APDL Command: EWRITE - - Writes the selected elements to a file. The write operation is not - necessary in a standard ANSYS run but is provided as convenience - to users wanting a coded element file. If issuing :meth:`ewrite` - from ANSYS to be used in ANSYS, you must also issue NWRITE to - store nodal information for later use. Only elements having all of - their nodes defined (and selected) are written. Data are written - in a coded format. The data description of each record is: I, J, - K, L, M, N, O, P, MAT, TYPE, REAL, SECNUM, ESYS, IEL, where MAT, - TYPE, REAL, and ESYS are attribute numbers, SECNUM is the beam - section number, and IEL is the element number. - - The format is (14I6) if Format is set to SHORT and (14I8) if the - Format is set to LONG, with one element description per record for - elements having eight nodes of less. For elements having more than - eight nodes, nodes nine and above are written on a second record - with the same format. - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, - including the characters needed for the directory path). - An unspecified directory path defaults to the working - directory; in this case, you can use all 248 characters - for the file name. - - ext - Filename extension (eight-character maximum). - - kappnd - Append key: - - 0 - Rewind file before the write operation. - - 1 - Append data to the end of the existing file. - - format_ - Format key: - - SHORT - I6 format (the default). - - LONG - I8 format. - - Examples - -------- - >>> mapdl.ewrite('etable.txt', format_='LONG') - """ - return self.run(f"EWRITE,{fname},{ext},,{kappnd},{format_}", **kwargs) - - def gcdef(self, option="", sect1="", sect2="", matid="", realid="", **kwargs): - """Defines interface interactions between general contact surfaces. - - APDL Command: GCDEF - - GCDEF defines the interface interaction between general contact - surfaces identified by SECT1 and SECT2. GCDEF commands are order - independent in most cases. - - GCDEF definitions should be issued after GCGEN. They are saved in the - database and are written to and read from .CDB files. - - See General Contact in the Contact Technology Guide for more - information on the overall procedure to create general contact. - - SECT1/SECT2 Interactions - - The most specific types of general contact definitions are those - described below: - - The remaining general contact definition types can be overridden by the - above two general contact definition types: - - Parameters - ---------- - option - Option to be performed. - - (blank) - Retain the previous Option setting between SECT1 and SECT2. - - AUTO - Define auto asymmetric contact between surfaces SECT1 and SECT2. - - SYMM - Define symmetric contact between surfaces SECT1 and SECT2. - - ASYM - Define asymmetric contact with SECT1 as the source - (contact) surface and SECT2 as the target surface. - - EXCL - Exclude contact between surfaces SECT1 and - SECT2. MATID and REALID are ignored. - - DELETE - Remove the given definition from the GCDEF - table. MATID and REALID are ignored. - - Note that GCDEF,DELETE,ALL,ALL does not remove the entire - GCDEF table; it merely removes any existing GCDEF,,ALL,ALL - definitions, while leaving intact any existing GCDEF - definitions that are more specific. - To remove the - entire GCDEF table, issue GCDEF,DELETE,TOTAL. - - It is good practice to list all definitions using - GCDEF,LIST,ALL,ALL before and after a GCDEF,DELETE - command. - - LIST - List stored GCDEF data entries. MATID and REALID are - ignored. GCDEF,LIST,ALL,ALL lists the entire GCDEF table, - including more specific GCDEF definitions. - TABLE - - sect1, sect2 - Section numbers representing general contact surfaces (no - defaults). Labels ALL and SELF are also valid input. See - SECT1/SECT2 Interactions for a description of how the various - inputs for SECT1 and SECT2 are interpreted. - - matid - Material ID number for general contact interaction properties at - the SECT1/SECT2 interface. If zero or blank, the previous setting - of MATID for SECT1/SECT2 (if any) is retained. - - realid - Real constant ID number for general contact interaction properties - at the SECT1/SECT2 interface. If zero or blank, the previous - setting of REALID for SECT1/SECT2 (if any) is retained. - """ - command = f"GCDEF,{option},{sect1},{sect2},{matid},{realid}" - return self.run(command, **kwargs) - - def gcgen( - self, - option="", - featureangle="", - edgekey="", - splitkey="", - selopt="", - **kwargs, - ): - """Creates contact elements for general contact. - - APDL Command: GCGEN - - Parameters - ---------- - option - Option to be performed. - - NEW - Create a new general contact definition. This option removes all existing - general contact elements and generates new elements with new - section IDs. Any existing GCDEF specifications, general - contact SECTYPE/SECDATA data, and general contact element - types are also removed. If no general contact elements or - data exist, this option behaves the same as Option = UPDATE. - - UPDATE - Generate general contact elements on newly added (or selected) base elements. - Newly generated contact elements are assigned new Section - IDs. Existing general contact elements remain with their - previously assigned section IDs and element attributes. - Existing GCDEF and SECTYPE/SECDATA general contact data - are respected. (This is the default option.) - - DELETE - Remove all existing general contact elements. Existing GCDEF specifications, - general contact SECTYPE/SECDATA data, and general contact - element types are also removed. - - SELECT - Select all existing general contact elements. - - featureangle - Angle tolerance for determining feature edges (EdgeKEY) and general - surfaces (SplitKey). Default = 42 degrees. - - edgekey - Key that controls creation of general contact line elements - (CONTA177) on base shell element perimeter edges and/or base solid - element feature edges. See Understanding FeatureANGLE for an - explanation of the feature edge criteria. - - 0 - Exclude feature edges and shell perimeter edges (default). - - 1 - Include feature edges only. - - 2 - Include shell perimeter edges only. - - 3 - Include both feature edges and shell perimeter edges. - - splitkey - Key that controls how section IDs and contact element type IDs are - assigned to surfaces. - - SPLIT - Assign a different section ID and contact element type ID for every general - surface of the selected base elements (default). See - Understanding FeatureANGLE for an explanation of the split - criteria. Different section IDs are assigned to top and - bottom surfaces of 2-D beam and 3-D shell bodies. This - allows different GCDEF specifications for different - portions of the assembly. - - PART - Assign a different section ID and contact element type ID for every general - surface which covers a physical part. Compared to the SPLIT - option, this option produces fewer unique section IDs, which - can make it easier to specify interactions via GCDEF. - However, it may also result in a less accurate and/or less - efficient solution. - - selopt - Key that controls which base elements are considered for general - contact. - - ATTACH - Use a recursive adjacency selection to obtain complete physical parts, starting - from the selected base elements, before generating general - contact elements (default). - - SELECT - Use only the initially selected base elements to generate general contact - elements. - - Notes - ----- - GCGEN creates general contact elements on the exterior faces of - selected base elements. The base elements can be 2-D or 3-D solids, 2-D - beams (top and bottom), or 3-D shells (top and bottom). The contact - element types can be CONTA172, CONTA174, and/or CONTA177, depending - upon the types of base elements in the model and the specified GCGEN - options. General contact elements are identified by a real constant ID - equal to zero. - - You can control contact interactions between specific general contact - surfaces that could potentially be in contact by using the GCDEF - command. See General Contact in the Contact Technology Guide for more - information on the overall procedure to create general contact. - - Understanding FeatureANGLE - - The exterior facets of the selected base solid and shell elements are - divided into subsets based on the angle between the normals of - neighboring faces. On a flat or smooth surface, adjacent exterior - element faces have normals that are parallel or nearly parallel; that - is, the angle between the adjacent normals is near zero degrees. - - When the angle between the normals of two adjacent faces is greater - than FeatureANGLE, the two faces are considered to be on two separate - surfaces (SplitKey = SPLIT). The edge between the faces may be convex - or concave. A convex (or outside) edge is considered to be a feature - edge and may be affected by the EdgeKEY setting. For more information, - see Feature Angle (FeatureANGLE) in the Contact Technology Guide. - """ - command = f"GCGEN,{option},{featureangle},{edgekey},{splitkey},{selopt}" - return self.run(command, **kwargs) - - def inistate( - self, - action="", - val1="", - val2="", - val3="", - val4="", - val5="", - val6="", - val7="", - val8="", - val9="", - **kwargs, - ): - """Defines initial state data and parameters. - - APDL Command: INISTATE - - Parameters - ---------- - action - Specifies action for defining or manipulating initial state data: - - SET - Use Action = SET to designate initial state coordinate system, data type, and - material type parameters. See "Command Specification for - Action = SET". - - DEFINE - Use Action = DEFINE to specify the actual state values, and the corresponding - element, integration point, or layer information. See - "Command Specifications for Action = DEFINE". - - WRITE - Use Action = WRITE to write the initial state values to a file when the SOLVE - command is issued. See "Command Specifications for Action = - WRITE". - - READ - Use Action = READ to read the initial state values from a file. See "Command - Specifications for Action = READ". - - LIST - Use Action = LIST to read out the initial state data. See "Command - Specifications for Action = LIST". - - DELETE - Use Action = DELE to delete initial state data from a selected set of elements. - See "Command Specifications for Action = DELETE" - - val1, val2, ..., val9 - Input values based on the Action type. - - Notes - ----- - The INISTATE command is available for current-technology elements. - Initial state supported for a given element is indicated in the - documentation for the element under "Special Features." - - The command is not for use with kinematic hardening material properties - (TB,BKIN, TB,KINH, TB,PLAS,,,,KINH) or the shape memory alloy material - model (TB,SMA). - - INISTATE with elastic strain alone is not supported for gasket - materials (TB,GASK) and hyperelastic materials (TB,HYPER, TB,BB, - TB,AHYPER, TB,CDM, TB,EXPE). - - INISTATE with initial stress alone is not supported for gasket - materials (TB,GASK). - - INISTATE with plastic strain (which must include initial strain or - stress, plastic strain, and accumulated plastic strain) does not - support gasket materials (TB,GASK), porous media (TB,PM), rate- - dependent plasticity (TB,RATE), and viscoplasticity (TB,PRONY, - TB,SHIFT). - - For detailed information about using the initial state capability, see - Initial State in the Basic Analysis Guide. - """ - command = f"INISTATE,{action},{val1},{val2},{val3},{val4},{val5},{val6},{val7},{val8},{val9}" - return self.run(command, **kwargs) - - def laylist(self, iel="", layr1="", layr2="", mplab1="", mplab2="", **kwargs): - """Lists real constants material properties for layered elements. - - APDL Command: LAYLIST - - Parameters - ---------- - iel - Element number to be listed. If ALL, list all selected elements - [ESEL] of the appropriate type. If blank and the current element - type is a layered element type, list data from the current real - constant table in the layered format. - - layr1, layr2 - Range of layer numbers to be listed. If LAYR1 is greater than - LAYR2, a reverse order list is produced. LAYR1 defaults to 1. - LAYR2 defaults to LAYR1 if LAYR1 is input or to the number of - layers if LAYR1 is not input. - - mplab1, mplab2 - Material property labels (e.g., EX) to be listed along with the - layer real constants. - - Notes - ----- - Lists real constants and any two material properties for layered shell - and solid elements. - - If matrix input is selected (KEYOPT(2) = 2 or 3), LAYR1, LAYR2, Mplab1, - and Mplab2 are not used. - - This command is valid in any processor. - """ - command = f"LAYLIST,{iel},{layr1},{layr2},{mplab1},{mplab2}" - return self.run(command, **kwargs) - - def layplot(self, iel="", layr1="", layr2="", **kwargs): - """Displays the layer stacking sequence for layered elements. - - APDL Command: LAYPLOT - - Parameters - ---------- - iel - Element number for the display. If blank and the current element - type is a layered element type, display data from the current real - constant table. - - layr1, layr2 - Range of layer numbers to be displayed. If LAYR1 is greater than - LAYR2, a reversed order display is produced. Up to 20 layers may - be displayed at a time. LAYR1 defaults to 1. LAYR2 defaults to - LAYR1 if LAYR1 is input or to the number of layers (or to 19+LAYR1, - if smaller) if LAYR1 is not input. - - Notes - ----- - Displays the layer-stacking sequence as defined in the real constant - table for layered shell and solid elements in a form where the layers - are visible (like a sheared deck of cards). - - The element x-axis is shown as 0.0 degrees. - - Layers are cross-hatched and color-coded for clarity. The hatch lines - indicate the layer angle (real constant THETA) and the color coding is - for material identification (real constant MAT). - - The actual orientation of a specific layer in three-dimensional space - can be seen using /PSYMB,LAYR. To use /PSYMB,LAYR with smeared - reinforcing elements (REINF265), first set the vector-mode graphics - option (/DEVICE,VECTOR,1). - - Layer thickness can be displayed using the /ESHAPE and EPLOT commands. - - This command is valid in any processor. - """ - command = f"LAYPLOT,{iel},{layr1},{layr2}" - return self.run(command, **kwargs) - - def lfsurf(self, sline="", tline="", **kwargs): - """Generates surface elements overlaid on the edge of existing solid - - APDL Command: LFSURF - elements and assigns the extra node as the closest fluid element node. - - Parameters - ---------- - sline - Component name for the surface lines of the meshed solid areas. - - tline - Component name for the target lines meshed with fluid elements. - - Notes - ----- - This command macro is used to generate surface effect elements overlaid - on the surface of existing plane elements and, based on proximity, to - determine and assign the extra node for each surface element. The - underlying areas of the solid region and the fluid lines must be meshed - prior to calling this command macro. The active element type must be - SURF151 with appropriate settings for KEYOPT(4), KEYOPT(5), KEYOPT(6), - and KEYOPT(8). - - The surface lines of the solid and the target lines of the fluid are - grouped into components and named using the CM command. The names must - be enclosed in single quotes (e.g., 'SLINE') when the LFSURF command is - manually typed in. - - When using the GUI method, node and element components are created - through the picking dialog boxes associated with this command. - - The macro is applicable for the SURF151 and FLUID116 element types. - """ - command = f"LFSURF,{sline},{tline}" - return self.run(command, **kwargs) - - def ndsurf(self, snode="", telem="", dimn="", **kwargs): - """Generates surface elements overlaid on the edge of existing elements - - APDL Command: NDSURF - and assigns the extra node as the closest fluid element node. - - Parameters - ---------- - snode - Component name for the surface nodes of the solid elements. - - telem - Component name for the target fluid elements. - - dimn - Model dimensionality: - - 2 - 2-D model. - - 3 - 3-D model. - - Notes - ----- - This command macro is used to generate surface effect elements (SURF151 - or SURF152) overlaid on the surface of existing plane or solid elements - and, based on proximity, to determine and assign the extra node - (FLUID116) for each surface element. The active element type must be - SURF151 or SURF152 with appropriate settings for KEYOPT(4), KEYOPT(5), - KEYOPT(6), and KEYOPT(8). - - The surface nodes of the plane or solid elements must be grouped into a - node component and the fluid elements must be grouped into an element - component and named using the CM command. The names must be enclosed - in single quotes (e.g., 'NOD') when the NDSURF command is manually - typed in. - - When using the GUI method, node and element components are created - through the picking dialog boxes associated with this command. - - The macro is applicable for the SURF151, SURF152, and FLUID116 element - types. - """ - command = f"NDSURF,{snode},{telem},{dimn}" - return self.run(command, **kwargs) - - def shsd(self, rid="", action="", **kwargs): - """Creates or deletes a shell-solid interface to be used in shell-to-solid assemblies. - - APDL Command: SHSD - - Parameters - ---------- - rid - The real constant set ID that identifies the contact pair on - which a shell-to-solid assembly is defined. If ALL, all - selected contact pairs will be considered for assembly. - - Action - * ``"CREATE"`` : Builds new shell and contact elements to be - used in shell-to-solid assemblies (default). New elements - are stored as internally-created components. - - * ``"DELETE"`` : Deletes the nodes and elements created during - a previous execution of SHSD,RID,CREATE for the real - constant set identified by RID. - - Notes - ----- - The SHSD command creates a shell-solid interface to be used in - shell-to-solid assemblies, or deletes a previously-created - shell-solid interface. "Virtual" shell elements and additional - CONTA175 elements are created at the contact pair identified by - RID when Action = CREATE. Set Action = DELETE to remove the - generated nodes and elements at the contact pair identified by - RID. - - For further details, see: - https://www.mm.bme.hu/~gyebro/files/ans_help_v182/ans_cmd/Hlp_C_SHSD.html - """ - return self.run(f"SHSD,{rid},{action}", **kwargs) - - def swadd( - self, - ecomp="", - shrd="", - ncm1="", - ncm2="", - ncm3="", - ncm4="", - ncm5="", - ncm6="", - ncm7="", - ncm8="", - ncm9="", - **kwargs, - ): - """Adds more surfaces to an existing spot weld set. - - APDL Command: SWADD - - Parameters - ---------- - ecomp - Name of an existing spot weld set that was previously defined using - SWGEN. - - shrd - Search radius. Defaults to 4 times the spot weld radius defined for - the spot weld set (SWRD on SWGEN). - - ncm1, ncm2, ncm3, . . . , ncm9 - Surfaces to be added to the spot weld set. Each surface can be - input as a predefined node component or a meshed area number. - - Notes - ----- - This command adds surfaces to an existing spot weld set defined by the - SWGEN command. You can add additional surfaces by repeating the SWADD - command. However, the maximum number of allowable surfaces (including - the 2 surfaces used for the original set defined by SWGEN) for each - spot weld set is 11. See Adding Surfaces to a Basic Set for more - information. - """ - command = f"SWADD,{ecomp},{shrd},{ncm1},{ncm2},{ncm3},{ncm4},{ncm5},{ncm6},{ncm7},{ncm8},{ncm9}" - return self.run(command, **kwargs) - - def swdel(self, ecomp="", **kwargs): - """Deletes spot weld sets. - - APDL Command: SWDEL - - Parameters - ---------- - ecomp - Name of an existing spot weld set that was previously defined using - SWGEN. If Ecomp = ALL (default) all spot welds are deleted. - - Notes - ----- - This command deletes spot weld sets previously defined by the SWGEN - command. - """ - command = f"SWDEL,{ecomp}" - return self.run(command, **kwargs) - - def swgen( - self, - ecomp="", - swrd="", - ncm1="", - ncm2="", - snd1="", - snd2="", - shrd="", - dirx="", - diry="", - dirz="", - itty="", - icty="", - **kwargs, - ): - """Creates a new spot weld set. - - APDL Command: SWGEN - - Parameters - ---------- - ecomp - Name to identify the new spot weld. This name will be used for the - element component containing the new contact, target, and beam - elements generated for the spot weld set. - - swrd - Spot weld radius. - - ncm1 - Name of a component containing nodes on the first spot weld - surface, or a meshed area number for the surface. - - ncm2 - Name of a component containing nodes on the second spot weld - surface, or a meshed area number for the surface. - - snd1 - Node number of the first spot weld node corresponding to the first - surface (NCM1). This node can be on or close to the first surface. - - snd2 - Node number of the second spot weld node corresponding to the - second surface (NCM2). This node can be on or close to the second - surface. ANSYS will create the node if it is not specified. - - shrd - Search radius. Defaults to 4 times the spot weld radius SWRD. - - dirx, diry, dirz - Spot weld projection direction in terms of normal X, Y, and Z - components. - - itty - Target element type ID. - - icty - Contact element type ID. - - Notes - ----- - This command creates a new spot weld set. You can add more surfaces to - the set using SWADD after the initial SWGEN command. However, the - maximum number of allowable surfaces (including the 2 surfaces used for - the original set) for each spot weld set is 11. - - Ecomp, SWRD, NCM1, NCM2, and SND1 must be specified. SND2, SHRD, DIRX, - DIRY, DIRZ, ITTY, ICTY are optional inputs. If the second spot weld - node (SND2) is specified, that node is used to determine the spot weld - projection direction, andDIRX, DIRY and DIRZ are ignored. - - If ITTY is specified, the following corresponding target element key - option must be set: KEYOPT(5) = 4. If ICTY is specified, the following - corresponding contact element key options must be set: KEYOPT(2) = 2, - KEYOPT(12) = 5. - - Use the SWLIST and SWDEL commands to list or delete spot welds. See - Creating a Basic Spot Weld Set with SWGEN for detailed information on - defining spot welds. - """ - command = f"SWGEN,{ecomp},{swrd},{ncm1},{ncm2},{snd1},{snd2},{shrd},{dirx},{diry},{dirz},{itty},{icty}" - return self.run(command, **kwargs) - - def swlist(self, ecomp="", **kwargs): - """Lists spot weld sets. - - APDL Command: SWLIST - - Parameters - ---------- - ecomp - Name of an existing spot weld set that was previously defined using - SWGEN. If Ecomp = ALL (default), all spot weld sets are listed. - - Notes - ----- - This command lists spot weld node, beam, and contact pair information - for all defined spot weld sets, or for the specified set. To ensure - that all defined spotwelds are listed, issue CMSEL,ALL (to select all - components) before issuing the SWLIST command. - - When SWLIST is issued in POST1, the beam forces and moments are output. - For the case of a deformable spot weld, the stresses are also output in - the beam local coordinate system. - """ - command = f"SWLIST,{ecomp}" - return self.run(command, **kwargs) - - def tshap(self, shape="", **kwargs): - """Defines simple 2-D and 3-D geometric surfaces for target segment - - APDL Command: TSHAP - elements. - - Parameters - ---------- - shape - Specifies the geometric shapes for target segment elements TARGE169 - and TARGE170. - - LINE - Straight line (2-D, 3-D) (Default for 2-D) - - PARA - Parabola (2-D, 3-D) - - ARC - Clockwise arc (2-D) - - CARC - Counterclockwise arc (2-D) - - CIRC - Complete circle (2-D) - - TRIA - Three-node triangle (3-D) (Default for 3-D) - - TRI6 - Six-node triangle (3-D) - - QUAD - Four-node quadrilateral (3-D) - - QUA8 - Eight-node quadrilateral (3-D) - - CYLI - Cylinder (3-D) - - CONE - Cone (3-D) - - SPHE - Sphere (3-D) - - PILO - Pilot node (2-D, 3-D) - - POINT - Point (rigid surface node) (2-D, 3-D) - - Notes - ----- - Use this command to specify the target segment shapes for the rigid - target surface associated with surface-to-surface contact (TARGE169, - CONTA171, CONTA172 (2-D) and TARGE170, CONTA173, CONTA174 (3-D)), 3-D - beam-to-beam contact (TARGE170 and CONTA176), and 3-D line-to-surface - contact (TARGE170 and CONTA177). Once you issue TSHAP, all subsequent - target elements generated via the direct element generation technique - will have the same shape, until you issue TSHAP again with a different - Shape value. - """ - command = f"TSHAP,{shape}" - return self.run(command, **kwargs) - - def upgeom(self, factor="", lstep="", sbstep="", fname="", ext="", **kwargs): - """Adds displacements from a previous analysis and updates the geometry of - - APDL Command: UPGEOM - the finite element model to the deformed configuration. - - Parameters - ---------- - factor - Multiplier for displacements being added to coordinates. The value - 1.0 will add the full value of the displacements to the geometry of - the finite element model. Defaults to 1.0. - - lstep - Load step number of data to be imported. Defaults to the last load - step. - - sbstep - Substep number of data to be imported. Defaults to the last - substep. - - fname - File name and directory path (248 characters maximum, including the - characters needed for the directory path). An unspecified - directory path defaults to the working directory; in this case, you - can use all 248 characters for the file name. - - ext - Filename extension (eight-character maximum). - - Notes - ----- - This command updates the geometry of the finite element model according - to the displacement results of the previous analysis and creates a - revised geometry at the deformed configuration. This command works on - all nodes (default) or on a selected set of nodes. If this command is - issued repeatedly, it creates a revised geometry of the finite element - model in a cumulative fashion, i.e., it adds displacement results on - the previously generated deformed geometry. The solid model geometry is - not updated by this command. - - When UPGEOM is issued, the current finite element model is overwritten - by finite element information from the results file. For this reason, - it is important that the finite element information in the results file - matches the finite element model in which the nodal coordinates are - being updated. No changes should be made to the model before the UPGEOM - command is issued. - """ - command = f"UPGEOM,{factor},{lstep},{sbstep},{fname},{ext}" - return self.run(command, **kwargs) - - def usrdof( - self, - action="", - dof1="", - dof2="", - dof3="", - dof4="", - dof5="", - dof6="", - dof7="", - dof8="", - dof9="", - dof10="", - **kwargs, - ): - """Specifies the degrees of freedom for the user-defined element USER300. - - APDL Command: USRDOF - - Parameters - ---------- - action - One of the following command operations: - - DEFINE - Specify the degrees of freedom (DOFs). This value is the default. - - LIST - List all previously specified DOFs. - - DELETE - Delete all previously specified DOFs. - - dof1, dof2, dof3, . . . , dof10 - The list of DOFs. - - Notes - ----- - The USRDOF command specifies the degrees of freedom for the user- - defined element USER300. - - Although you can intersperse other commands as necessary for your - analysis, issue the USRDOF command as part of the following general - sequence of commands: - - Issue the ET command for element USER300, followed by the related TYPE - command. - - Issue both the USRELEM and USRDOF commands (in either order). - - Define your element using USER300. - - The DOF list (DOF1 through DOF10) can consist of up to 10 DOFs. Use any - valid and appropriate DOF (such as UX, UY, UZ, ROTX, ROTY, ROTZ, AX, - AY, AZ, VX, VY, VZ, PRES, WARP, TEMP, VOLT, MAG, EMF, and CURR). - - You can specify a maximum of 10 DOFs per USRDOF command. To define - additional DOFs, issue the command again. - - The maximum number of DOFs for a user-defined element--the number of - nodes times the number of DOFs per node--cannot exceed 480. - - To learn more about user-defined elements, see Creating a New Element - in the Programmer's Reference. - """ - command = f"USRDOF,{action},{dof1},{dof2},{dof3},{dof4},{dof5},{dof6},{dof7},{dof8},{dof9},{dof10}" - return self.run(command, **kwargs) - - def usrelem( - self, - nnodes="", - ndim="", - keyshape="", - nreal="", - nsavevars="", - nrsltvar="", - keyansmat="", - nintpnts="", - kestress="", - keysym="", - **kwargs, - ): - """Specifies the characteristics of the user-defined element USER300. - - APDL Command: USRELEM - - Parameters - ---------- - nnodes - The number of nodes. - - ndim - The number of dimensions (of nodal coordinates). Valid values are 2 - or 3. - - keyshape - One of the following element shape options: - - ANYSHAPE - Any shape (that is, no specified shape). This value is the default. (The ANSYS - MeshTool is unavailable.) - - POINT - Point. - - LINE - Straight line. - - TRIAN - Triangle. - - QUAD - Quadrilateral. This shape can be degenerated to a triangle. - - TET - Tetrahedron. - - BRICK - Brick. This shape can be degenerated to a wedge, pyramid, or tetrahedron. - - nreal - The number of real constants. - - nsavevars - The number of saved variables. - - nrsltvar - The number of variables saved in results files. - - keyansmat - Key for element formulation control: - - 0 - Create your own material codes within the element formulation. In this case, - the real constants are available to input material properties. - You can also input linear material properties via MP and MPDATA - commands . - - 1 - Use ANSYS standard material routines or the USERMAT subroutine to form - structural material data. ANSYS material properties must be - input in the standard way (as you would for non-user-defined - elements). This value is invalid when KeyShape = ANYSHAPE. - - nintpnts - The maximum number of integration points (used when KEYANSMAT = 1). - - kestress - Key for the element stress state (used when KEYANSMAT = 1): - - 0 - Plane stress elements. - - 1 - Axisymmetric elements. - - 2 - Plane strain elements. - - 3 - 3-D solid elements. - - 4 - 3-D solid-shell elements. - - 5 - Generalized plane strain elements. - - 6 - Beam elements. - - 7 - Link/truss elements. - - 8 - 3-D shell elements. - - 9 - Axisymmetric shell elements. - - keysym - Key for specifying whether element stiffness matrices are symmetric - or unsymmetric: - - 0 - Symmetric. - - 1 - Unsymmetric. - - Notes - ----- - The USRELEM command specifies the characteristics of the user-defined - element USER300. - - Although you can intersperse other commands as necessary for your - analysis, issue the USRELEM command as part of the following general - sequence of commands: - - Issue the ET command for element USER300, followed by the related TYPE - command. - - Issue both the USRELEM and USRDOF commands (in either order). - - Define your element using USER300. - - The number of real constants (NREAL) can refer to geometry quantities, - material quantities, or any parameters for element formulation. - - ANSYS saves variables in the .esav file to preserve element data when - you specify a positive NSAVEVARS value. When KEYANSMAT = 0, all - variables of both material and kinematic formulation are saved. When - KEYANSMAT = 1, only the variables for kinematic formulation (such as - deformation gradient tensor) are saved; in this case, the material - routine saves all necessary material data automatically. - - Element data saved in results files (NRSLTVAR) are accessible only as - nonsummable miscellaneous data. ANSYS saves stress and total strain - data for structural elements in the .rst file automatically (as it does - for equivalent variables such as thermal gradient and thermal flux in - thermal elements); therefore, NRSLTVAR does not need to include stress - and total strain data. - - To learn more about creating user-defined elements, see Creating a New - Element in the Programmer's Reference. - """ - command = f"USRELEM,{nnodes},{ndim},{keyshape},{nreal},{nsavevars},{nrsltvar},{keyansmat},{nintpnts},{kestress},{keysym}" - return self.run(command, **kwargs) - - def wtbcreate(self, iel="", node="", damp="", **kwargs): - """Creates a USER300 element to model the turbine for full aeroelastic - - APDL Command: WTBCREATE - coupling analysis and specifies relevant settings for the analysis. - - Parameters - ---------- - iel - Element number (next available number by default). - - node - Node number connecting support structure and turbine. - - damp - Damping option for the turbine: - - 0 - Damping matrix obtained from the aeroelastic code plus Rayleigh damping - (default). - - 1 - Rayleigh damping only. - - 2 - Damping from the aeroelastic code only. - - Notes - ----- - WTBCREATE invokes a predefined ANSYS macro that will automatically - generate a turbine element and issue relevant data commands that are - necessary to run a full aeroelastic coupling analysis. For detailed - information on how to perform a fully coupled aeroelastic analysis, see - Fully Coupled Wind Turbine Example in Mechanical APDL in the Mechanical - APDL Programmer's Reference. - - The generated USER300 turbine element will have 9 nodes with node - numbers NODE, NMAX+1, NMAX+2, ..., NMAX+8, where NMAX is the maximum - node number currently in the model. - - There are 6 freedoms on the first node of the element: UX, UY, UZ, - ROTX, ROTY, ROTZ, and these are true structural freedoms. For all the - other nodes (i.e., nodes 2 to 9), only the translational freedoms (UX, - UY, UZ) are used. These are generalized freedoms that are internal to - the turbine element and are used by the aeroelastic code only. - - The element type integer of the USER300 element is the current maximum - element type integer plus one. - - The command will also set up the analysis settings appropriate for a - full aeroelastic coupling analysis. These include full Newton-Raphson - solution (NROPT,FULL) and a USRCAL command to activate the relevant - user routines. - """ - command = f"WTBCREATE,{iel},{node},{damp}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/hard_points.py b/src/ansys/mapdl/core/_commands/preproc/hard_points.py deleted file mode 100644 index c5877aca89e..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/hard_points.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class HardPoints: - def hptcreate( - self, - type_="", - entity="", - nhp="", - label="", - val1="", - val2="", - val3="", - **kwargs, - ): - """Defines a hard point. - - APDL Command: HPTCREATE - - Parameters - ---------- - type\\_ - Type of entity on which the hard point will be created. - - LINE - Hard point will be created on a line. - - AREA - Hard point will be created within an area (not on the boundaries). - - entity - Number of the line or area on which the hard point will be created. - - nhp - Number assigned to the hard point. Defaults to the lowest - available hard point number. - - label - If LABEL = COORD, VAL1, VAL2, and VAL3 are the respective global X, - Y, and Z coordinates. If LABEL = RATIO, VAL1 is the parameter - value (this is available only for lines). Valid parameter values - are between 0 and 1. VAL2 and VAL3 are ignored. - - val1 - If LABEL = RATIO, ratio value for line. If LABEL = COORD, global X - coordinate value. - - val2 - If LABEL = COORD, global Y coordinate value. - - val3 - If LABEL = COORD, global Z coordinate value. - - Notes - ----- - The ability to enter a parameter value provides a simple way of - positioning hard points on lines. For example, to place a hard point - halfway along a line, one can simply specify a VAL1 value of 0.5. - - For models imported through the DEFAULT IGES filter, you can place hard - points on models only by specifying coordinates (you can't place a hard - point using interactive picking). - - If you issue any commands that update the geometry of an entity, such - as Boolean or simplification commands, any hard points associated with - that entity are deleted. Therefore, you should add any hard points - after completing the solid model. If you delete an entity that has - associated hard points, those hard points are either - - Deleted along with the entity (if the hard point is not associated with - any other entities). - - Detached from the deleted entity (if the hard point is associated with - additional entities). - - When archiving your model (CDWRITE), hardpoint information cannot be - written to the IGES file. The Jobname.cdb file can be written with the - CDWRITE,DB option. - - Hard points are only applicable for area and volume meshing, not for - beams. - """ - command = f"HPTCREATE,{type_},{entity},{nhp},{label},{val1},{val2},{val3}" - return self.run(command, **kwargs) - - def hptdelete(self, np1="", np2="", ninc="", **kwargs): - """Deletes selected hardpoints. - - APDL Command: HPTDELETE - - Parameters - ---------- - np1, np2, ninc - Delete the pattern of hard points beginning with NP1 to NP2 in - steps of NINC (defaults to 1). If NP1 = ALL, NP2 and NINC are - ignored and the pattern is all selected hard points [KSEL]. If NP1 - = P, graphical picking is enabled and all remaining command fields - are ignored. - - Notes - ----- - Deletes all attributes attached to the designated hard points as well - as the hard points themselves. If any entity is attached to a - designated hard point, the command detaches the hard point from that - entity (the program will alert you that this will occur). - """ - command = f"HPTDELETE,{np1},{np2},{ninc}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/keypoints.py b/src/ansys/mapdl/core/_commands/preproc/keypoints.py deleted file mode 100644 index d9c8926d4c4..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/keypoints.py +++ /dev/null @@ -1,888 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from ansys.mapdl.core._commands import parse - - -class KeyPoints: - def k(self, npt="", x="", y="", z="", **kwargs) -> int: - """Define a keypoint. - - APDL Command: K - - Defines a keypoint in the active coordinate system [CSYS] for - line, area, and volume descriptions. A previously defined - keypoint of the same number will be redefined. Keypoints may - be redefined only if it is not yet attached to a line or is - not yet meshed. Solid modeling in a toroidal system is not - recommended. - - Parameters - ---------- - npt - Reference number for keypoint. If zero, the lowest - available number is assigned [NUMSTR]. - - x, y, z - Keypoint location in the active coordinate system (may be - R, θ, Z or R, θ, Φ). - - Returns - ------- - int - The keypoint number of the generated keypoint. - - Examples - -------- - Create keypoint at ``(0, 1, 2)`` - - >>> knum = mapdl.k('', 0, 1, 2) - >>> knum - 1 - - Create keypoint at ``(10, 11, 12)`` while specifying the - keypoint number. - - >>> knum = mapdl.k(5, 10, 11, 12) - >>> knum - 5 - """ - command = f"K,{npt},{x},{y},{z}" - return parse.parse_k(self.run(command, **kwargs)) - - def kbetw(self, kp1="", kp2="", kpnew="", type_="", value="", **kwargs) -> int: - """Creates a keypoint between two existing keypoints. - - APDL Command: KBETW - - Placement of the new keypoint depends on the currently active - coordinate system [CSYS]. If the coordinate system is - Cartesian, the keypoint will lie on a straight line between - KP1 and KP2. If the system is not Cartesian (e.g., - cylindrical, spherical, etc.), the keypoint will be located as - if on a line (which may not be straight) created in the - current coordinate system between KP1 and KP2. Note that - solid modeling in a toroidal coordinate system is not - recommended. - - Parameters - ---------- - kp1 - First keypoint. - - kp2 - Second keypoint. - - kpnew - Number assigned to the new keypoint. Defaults to the - lowest available keypoint number. - - type\\_ - Type of input for VALUE. - - RATIO - Value is the ratio of the distances between keypoints as follows: - ``(KP1-KPNEW)/(KP1-KP2)``. - - DIST - Value is the absolute distance between KP1 and - KPNEW (valid only if current coordinate system is - Cartesian). - - value - Location of new keypoint, as defined by Type (defaults to - 0.5). If VALUE is a ratio (Type = RATIO) and is less than - 0 or greater than 1, the keypoint is created on the - extended line. Similarly, if VALUE is a distance (Type = - DIST) and is less than 0 or greater than the distance - between KP1 and KP2, the keypoint is created on the - extended line. - - Returns - ------- - int - Keypoint number of the generated keypoint. - - Examples - -------- - Create a keypoint exactly centered between two keypoints. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> k2 = mapdl.kbetw(k0, k1) - >>> k2 - 3 - """ - command = f"KBETW,{kp1},{kp2},{kpnew},{type_},{value}" - return parse.parse_kpoint(self.run(command, **kwargs)) - - def kcenter( - self, type_="", val1="", val2="", val3="", val4="", kpnew="", **kwargs - ) -> int: - """Creates a keypoint at the center of a circular arc defined - by three locations. - - APDL Command: KCENTER - - KCENTER should be used in the Cartesian coordinate system - (CSYS,0) only. - - Parameters - ---------- - type\\_ - Type of entity used to define the circular arc. The - meaning of VAL1 through VAL4 will vary depending on Type. - - KP - Arc is defined by keypoints. - - LINE - Arc is defined by locations on a line. - - val1, val2, val3, val4 - Values used to specify three locations on the arc (see table - below). - - kpnew - Number assigned to new keypoint. Defaults to the lowest available - keypoint number. - - Returns - ------- - int - Keypoint number of the generated keypoint. - - Examples - -------- - Create a keypoint at the center of a circle centered at (0, 0, 0) - - >>> k0 = mapdl.k("", 0, 1, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> k2 = mapdl.k("", 0, -1, 0) - >>> k3 = mapdl.kcenter('KP', k0, k1, k2) - >>> k3 - 4 - """ - command = f"KCENTER,{type_},{val1},{val2},{val3},{val4},{kpnew}" - return parse.parse_kpoint(self.run(command, **kwargs)) - - def kdele(self, np1="", np2="", ninc="", **kwargs): - """Deletes unmeshed keypoints. - - APDL Command: KDELE - - Deletes selected keypoints. A keypoint attached to a line cannot be - deleted unless the line is first deleted. - - Parameters - ---------- - np1, np2, ninc - Delete keypoints from NP1 to NP2 (defaults to NP1) in steps of NINC - (defaults to 1). If NP1 = ALL, NP2 and NINC are ignored and all - selected keypoints [KSEL] are deleted. If NP1 = P, graphical - picking is enabled and all remaining command fields are ignored - (valid only in the GUI). A component name may also be substituted - for NP1 (NP2 and NINC are ignored). - """ - command = f"KDELE,{np1},{np2},{ninc}" - return self.run(command, **kwargs) - - def kdist(self, kp1="", kp2="", **kwargs) -> list: - """Calculates and lists the distance between two keypoints. - - APDL Command: KDIST - - Parameters - ---------- - kp1 - First keypoint in distance calculation. - kp2 - Second keypoint in distance calculation. - - Returns - ------- - list - ``[DIST, X, Y, Z]`` distance between two keypoints. - - Notes - ----- - KDIST lists the distance between keypoints KP1 and KP2, as - well as the current coordinate system offsets from KP1 to KP2, - where the X, Y, and Z locations of KP1 are subtracted from the - X, Y, and Z locations of KP2 (respectively) to determine the - offsets. KDIST is valid in any coordinate system except - toroidal [CSYS,3]. - This command is valid in any processor. - - Examples - -------- - Compute the distance between two keypoints. - - >>> kp0 = (0, 10, -3) - >>> kp1 = (1, 5, 10) - >>> knum0 = mapdl.k("", *kp0) - >>> knum1 = mapdl.k("", *kp1) - >>> dist = mapdl.kdist(knum0, knum1) - >>> dist - [13.96424004376894, 1.0, -5.0, 13.0] - """ - return parse.parse_kdist(self.run(f"KDIST,{kp1},{kp2}", **kwargs)) - - def kfill(self, np1="", np2="", nfill="", nstrt="", ninc="", space="", **kwargs): - """Generates keypoints between two keypoints. - - APDL Command: KFILL - - Generates keypoints (in the active coordinate system) between two - existing keypoints. The two keypoints may have been defined in any - coordinate system. However, solid modeling in a toroidal coordinate - system is not recommended. Any number of keypoints may be filled in - and any keypoint numbering sequence may be assigned. - - Parameters - ---------- - np1, np2 - Beginning and ending keypoints for fill-in. NP1 defaults to next - to last keypoint specified, NP2 defaults to last keypoint - specified. If NP1 = P, graphical picking is enabled and all - remaining command fields are ignored (valid only in the GUI). - - nfill - Fill NFILL keypoints between NP1 and NP2 (defaults to ``|NP2-NP1|-1``). - NFILL must be positive. - - nstrt - Keypoint number assigned to first filled-in keypoint (defaults to - NP1 + NINC). - - ninc - Add this increment to each of the remaining filled-in keypoint - numbers (may be positive or negative). Defaults to - ``(NP2-NP1)/(NFILL + 1)``, i.e., linear interpolation. - - space - Spacing ratio. Ratio of last division size to first division size. - If > 1.0, divisions increase. If < 1.0, divisions decrease. Ratio - defaults to 1.0 (uniform spacing). - """ - command = f"KFILL,{np1},{np2},{nfill},{nstrt},{ninc},{space}" - return self.run(command, **kwargs) - - def kgen( - self, - itime="", - np1="", - np2="", - ninc="", - dx="", - dy="", - dz="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Generates additional keypoints from a pattern of keypoints. - - APDL Command: KGEN - - Parameters - ---------- - itime - Do this generation operation a total of ITIME times, incrementing - all keypoints in the given pattern automatically (or by KINC) each - time after the first. ITIME must be more than 1 for generation to - occur. - - np1, np2, ninc - Generate keypoints from the pattern of keypoints beginning - with NP1 to NP2 (defaults to NP1) in steps of NINC - (defaults to 1). If NP1 = ALL, NP2 and NINC are ignored - and the pattern is all selected keypoints [KSEL]. If NP1 - is negative, NP2 and NINC are ignored and the last - ``|NP1|`` keypoints (in sequence from the highest keypoint - number) are used as the pattern to be repeated. A - component name may also be substituted for NP1 (NP2 and - NINC are ignored). - - dx, dy, dz - Keypoint location increments in the active coordinate system (DR, - Dθ, DZ for cylindrical, DR, Dθ, DΦ for spherical). - - kinc - Keypoint increment between generated sets. If zero, the lowest - available keypoint numbers are assigned [NUMSTR]. - - noelem - Specifies if elements and nodes are also to be generated: - - 0 - Generate nodes and point elements associated with the - original keypoints, if they exist. - - 1 - Do not generate nodes and elements. - - imove - Specifies whether keypoints will be moved or newly defined: - - 0 - Generate additional keypoints as requested with the - ITIME argument. - - 1 - Move original keypoints to new position retaining the - same keypoint numbers (ITIME, KINC, and NOELEM are - ignored). Valid only if the old keypoints are no - longer needed at their original positions. - Corresponding meshed items are also moved if not - needed at their original position. - - Notes - ----- - Generates additional keypoints (and corresponding mesh) from a given - keypoint pattern. The MAT, TYPE, REAL, and ESYS attributes are based - upon the keypoints in the pattern and not upon the current settings. - Generation is done in the active coordinate system. Keypoints in the - pattern may have been defined in any coordinate system. However, solid - modeling in a toroidal coordinate system is not recommended. - """ - command = ( - f"KGEN,{itime},{np1},{np2},{ninc},{dx},{dy},{dz},{kinc},{noelem},{imove}" - ) - return self.run(command, **kwargs) - - def kl(self, nl1="", ratio="", nk1="", **kwargs) -> int: - """Generates a keypoint at a specified location on an existing line. - - APDL Command: KL - - Parameters - ---------- - nl1 - Number of the line. If negative, the direction of line - (as interpreted for RATIO) is reversed. - - ratio - Ratio of line length to locate keypoint. Must be between - 0.0 and 1.0. Defaults to 0.5 (divide the line in half). - - nk1 - Number to be assigned to keypoint generated at division - location (defaults to lowest available keypoint number - [NUMSTR]). - - Returns - ------- - int - Keypoint number of the generated keypoint. - - Examples - -------- - Create a keypoint on a line from (0, 0, 0) and (10, 0, 0) - - >>> kp0 = (0, 0, 0) - >>> kp1 = (10, 0, 0) - >>> knum0 = mapdl.k("", *kp0) - >>> knum1 = mapdl.k("", *kp1) - >>> lnum = mapdl.l(knum0, knum1) - >>> lnum - 1 - """ - cmd = f"KL,{nl1},{ratio},{nk1}" - return parse.parse_kl(self.run(cmd, **kwargs)) - - def klist(self, np1="", np2="", ninc="", lab="", **kwargs): - """Lists the defined keypoints or hard points. - - APDL Command: KLIST - - Lists keypoints in the active display coordinate system [DSYS]. An - attribute (TYPE, MAT, REAL, or ESYS) listed as a zero is unassigned; - one listed as a positive value indicates that the attribute was - assigned with the KATT command (and will not be reset to zero if the - mesh is cleared); one listed as a negative value indicates that the - attribute was assigned using the attribute pointer [TYPE, MAT, REAL, or - ESYS] that was active during meshing (and will be reset to zero if the - mesh is cleared). - - This command is valid in any processor. - - Parameters - ---------- - np1, np2, ninc - List keypoints from NP1 to NP2 (defaults to NP1) in steps of NINC - (defaults to 1). If NP1 = ALL (default), NP2 and NINC are ignored - and all selected keypoints [KSEL] are listed. If NP1 = P, - graphical picking is enabled and all remaining command fields are - ignored (valid only in the GUI). A component name may also be - substituted for NP1 (NP2 and NINC are ignored). - - lab - Coordinate listing key: - - (blank) - List all keypoint information. - - COORD - Suppress all but the keypoint coordinates (shown to a higher degree of accuracy - than when displayed with all information). - - HPT - List only hard point information. - """ - command = f"KLIST,{np1},{np2},{ninc},{lab}" - return self.run(command, **kwargs) - - def kmodif(self, npt="", x="", y="", z="", **kwargs): - """Modifies an existing keypoint. - - APDL Command: KMODIF - - Parameters - ---------- - npt - Modify coordinates of this keypoint. If NPT = ALL, modify - coordinates of all selected keypoints [KSEL]. If NPT = P, - graphical picking is enabled and all remaining command fields are - ignored (valid only in the GUI). A component name may also be - substituted for NPT. - - x, y, z - Replace the previous coordinate values assigned to this keypoint - with these corresponding coordinate values. Values are interpreted - according to the active coordinate system (R, θ, Z for cylindrical, - R, θ,Φ for spherical). If X = P, graphical picking is used to - locate keypoint and Y and Z are ignored. A blank retains the - previous value. You cannot specify Y = P. - - Notes - ----- - Lines, areas, and volumes attached to the modified keypoint (if any) - must all be selected and will be redefined using the active coordinate - system. However, solid modeling in a toroidal coordinate system is not - recommended. - - Caution:: : Redefined entities may be removed from any defined - components and assemblies. Nodes and elements will be automatically - cleared from any redefined keypoints, lines, areas, or volumes. - - The KMODIF command moves keypoints for geometry modification without - validating underlying entities. To merge keypoints and update higher - order entities, issue the NUMMRG command instead. - """ - command = f"KMODIF,{npt},{x},{y},{z}" - return self.run(command, **kwargs) - - def kmove( - self, - npt="", - kc1="", - x1="", - y1="", - z1="", - kc2="", - x2="", - y2="", - z2="", - **kwargs, - ): - """Calculates and moves a keypoint to an intersection. - - APDL Command: KMOVE - - Parameters - ---------- - npt - Move this keypoint. If NPT = P, graphical picking is enabled and - all remaining command fields are ignored (valid only in the GUI). - A component name may also be substituted for NPT. - - kc1 - First coordinate system number. Defaults to 0 (global Cartesian). - - x1, y1, z1 - Input one or two values defining the location of the keypoint in - this coordinate system. Input "U" for unknown value(s) to be - calculated and input "E" to use an existing coordinate value. - Fields are R1, θ1, Z1 for cylindrical, or R1, θ1, ϕ1 for spherical. - - kc2 - Second coordinate system number. - - x2, y2, z2 - Input two or one value(s) defining the location of the keypoint in - this coordinate system. Input "U" for unknown value(s) to be - calculated and input "E" to use an existing coordinate value. - Arguments are R2, θ2, Z2 for cylindrical, or R2, θ2, ϕ2 for - spherical. - - Notes - ----- - Calculates and moves a keypoint to an intersection location. The - keypoint must have been previously defined (at an approximate location) - or left undefined (in which case it is internally defined at the SOURCE - location). The actual location is calculated from the intersection of - three surfaces (implied from three coordinate constants in two - different coordinate systems). Note that solid modeling in a toroidal - coordinate system is not recommended. See the MOVE command for surface - and intersection details. The three (of six) constants easiest to - define should be used. The program will calculate the remaining three - coordinate constants. All arguments, except KC1, must be input. Use - the repeat command [``*REPEAT``] after the KMOVE command to move a series - of keypoints, if desired. - """ - command = f"KMOVE,{npt},{kc1},{x1},{y1},{z1},{kc2},{x2},{y2},{z2}" - return self.run(command, **kwargs) - - def knode(self, npt="", node="", **kwargs) -> str: - """Defines a keypoint at an existing node location. - - APDL Command: KNODE - - Parameters - ---------- - npt - Arbitrary reference number for keypoint. If zero, the - lowest available number is assigned [NUMSTR]. - - node - Node number defining global X, Y, Z keypoint location. A - component name may also be substituted for NODE. - - Returns - ------- - int - Keypoint number of the generated keypoint. - - Examples - -------- - Create a keypoint at a node at (1, 2, 3) - - >>> nnum = mapdl.n('', 1, 2, 3) - >>> knum1 = mapdl.knode('', nnum) - >>> knum1 - 1 - """ - cmd = f"KNODE,{npt},{node}" - return parse.parse_knode(self.run(cmd, **kwargs)) - - def kplot(self, np1="", np2="", ninc="", lab="", **kwargs): - """Displays the selected keypoints. - - APDL Command: KPLOT - - Parameters - ---------- - np1, np2, ninc - Display keypoints from NP1 to NP2 (defaults to NP1) in steps of - NINC (defaults to 1). If NP1 = ALL (default), NP2 and NINC are - ignored and all selected keypoints [KSEL] are displayed. - - lab - Determines what keypoints are plotted (one of the following): - - (blank) - Plots all keypoints. - - HPT - Plots only those keypoints that are hard points. - - Notes - ----- - This command is valid in any processor. - """ - command = f"KPLOT,{np1},{np2},{ninc},{lab}" - return self.run(command, **kwargs) - - def kpscale( - self, - np1="", - np2="", - ninc="", - rx="", - ry="", - rz="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Generates a scaled set of (meshed) keypoints from a pattern of - - APDL Command: KPSCALE - keypoints. - - Parameters - ---------- - np1, np2, ninc - Set of keypoints (NP1 to NP2 in steps of NINC) that defines the - pattern to be scaled. NP2 defaults to NP1, NINC defaults to 1. If - NP1 = ALL, NP2 and NINC are ignored and the pattern is defined by - all selected keypoints. If NP1 = P, graphical picking is enabled - and all remaining command fields are ignored (valid only in the - GUI). A component name may also be substituted for NP1 (NP2 and - NINC are ignored). - - rx, ry, rz - Scale factors to be applied to the X, Y, Z keypoint coordinates in - the active coordinate system (RR, Rθ, RZ for cylindrical; RR, Rθ, - RΦ for spherical). The Rθ and RΦ scale factors are interpreted as - angular offsets. For example, if CSYS = 1, an RX, RY, RZ input of - (1.5,10,3) would scale the specified keypoints 1.5 times in the - radial and 3 times in the Z direction, while adding an offset of 10 - degrees to the keypoints.) Zero, blank, or negative scale factor - values are assumed to be 1.0. Zero or blank angular offsets have - no effect. - - kinc - Increment to be applied to the keypoint numbers for generated set. - If zero, the lowest available keypoint numbers will be assigned - [NUMSTR]. - - noelem - Specifies whether nodes and elements are also to be generated: - - 0 - Nodes and point elements associated with the original keypoints will be - generated (scaled) if they exist. - - 1 - Nodes and point elements will not be generated. - - imove - Specifies whether keypoints will be moved or newly defined: - - 0 - Additional keypoints will be generated. - - 1 - Original keypoints will be moved to new position (KINC and NOELEM are ignored). - Use only if the old keypoints are no longer needed at their - original positions. Corresponding meshed items are also moved - if not needed at their original position. - - Notes - ----- - Generates a scaled set of keypoints (and corresponding mesh) from a - pattern of keypoints. The MAT, TYPE, REAL, and ESYS attributes are - based on the keypoints in the pattern and not the current settings. - Scaling is done in the active coordinate system. Keypoints in the - pattern could have been generated in any coordinate system. However, - solid modeling in a toroidal coordinate system is not recommended. - """ - command = f"KPSCALE,{np1},{np2},{ninc},{rx},{ry},{rz},{kinc},{noelem},{imove}" - return self.run(command, **kwargs) - - def kscale(self, kinc="", np1="", np2="", ninc="", rx="", ry="", rz="", **kwargs): - """Generates a scaled pattern of keypoints from a given keypoint pattern. - - APDL Command: KSCALE - - Parameters - ---------- - kinc - Do this scaling operation one time, incrementing all keypoints in - the given pattern by KINC. If KINC = 0, keypoints will be - redefined at the scaled locations. - - np1, np2, ninc - Scale keypoints from pattern beginning with NP1 to NP2 (defaults to - NP1) in steps of NINC (defaults to 1). If NP1 = ALL, NP2 and NINC - are ignored and pattern is all selected keypoints [KSEL]. If NP1 = - P, graphical picking is enabled and all remaining command fields - are ignored (valid only in the GUI). A component name may also be - substituted for NP1 (NP2 and NINC are ignored). - - rx, ry, rz - Scale factor ratios. Scaling is relative to the origin of the - active coordinate system (RR, Rθ, RZ for cylindrical, RR, Rθ, RΦ - for spherical). If > 1.0, pattern is enlarged. If < 1.0, pattern - is reduced. Ratios each default to 1.0. - - Notes - ----- - Generates a scaled pattern of keypoints from a given keypoint pattern. - Scaling is done in the active coordinate system (see analogous node - scaling [NSCALE]). Solid modeling in a toroidal coordinate system is - not recommended. - """ - command = f"KSCALE,{kinc},{np1},{np2},{ninc},{rx},{ry},{rz}" - return self.run(command, **kwargs) - - def ksum(self, **kwargs): - """Calculates and prints geometry statistics of the selected keypoints. - - APDL Command: KSUM - - Notes - ----- - Calculates and prints geometry statistics (centroid location, moments - of inertia, etc.) associated with the selected keypoints. Geometry - items are reported in the global Cartesian coordinate system. A unit - density is assumed, irrespective of any material associations [KATT, - MAT]. Items calculated by KSUM and later retrieved by a ``*GET`` or ``*VGET`` - command are valid only if the model is not modified after the KSUM - command is issued. - """ - command = f"KSUM," - return self.run(command, **kwargs) - - def ksymm( - self, - ncomp="", - np1="", - np2="", - ninc="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Generates a reflected set of keypoints. - - APDL Command: KSYMM - - Parameters - ---------- - ncomp - Symmetry key: - - X - X (or R) symmetry (default). - - Y - Y (or θ) symmetry. - - Z - Z (or Φ) symmetry. - - np1, np2, ninc - Reflect keypoints from pattern beginning with NP1 to NP2 (defaults - to NP1) in steps of NINC (defaults to 1). If NP1 = ALL, NP2 and - NINC are ignored and pattern is all selected keypoints [KSEL]. If - Ncomp = P, graphical picking is enabled and all remaining command - fields are ignored (valid only in the GUI). A component name may - also be substituted for NP1 (NP2 and NINC are ignored). - - kinc - Keypoint increment between sets. If zero, the lowest available - keypoint numbers are assigned [NUMSTR]. - - noelem - Specifies whether nodes and elements are also to be generated: - - 0 - Generate nodes and point elements associated with the original keypoints, if - they exist. - - 1 - Do not generate nodes and elements. - - imove - Specifies whether keypoints will be moved or newly defined: - - 0 - Generate additional keypoints. - - 1 - Move original keypoints to new position retaining the same keypoint numbers - (KINC and NOELEM are ignored). Valid only if the old keypoints - are no longer needed at their original positions. - Corresponding meshed items are also moved if not needed at - their original position. - - Notes - ----- - Generates a reflected set of keypoints (and corresponding mesh) from a - given keypoint pattern by a symmetry reflection (see analogous node - symmetry command, NSYM). The MAT, TYPE, REAL, and ESYS attributes are - based upon the keypoints in the pattern and not upon the current - settings. Reflection is done in the active coordinate system by - changing a particular coordinate sign. Keypoints in the pattern may - have been generated in any coordinate system. However, solid modeling - in a toroidal coordinate system is not recommended. - """ - command = f"KSYMM,{ncomp},{np1},{np2},{ninc},{kinc},{noelem},{imove}" - return self.run(command, **kwargs) - - def ktran( - self, - kcnto="", - np1="", - np2="", - ninc="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Transfers a pattern of keypoints to another coordinate system. - - APDL Command: KTRAN - - Parameters - ---------- - kcnto - Reference number of coordinate system where the pattern is to be - transferred. Transfer occurs from the active coordinate system. - - np1, np2, ninc - Transfer keypoints from pattern beginning with NP1 to NP2 (defaults - to NP1) in steps of NINC (defaults to 1). If NP1 = ALL, NP2 and - NINC are ignored and pattern is all selected keypoints [KSEL]. If - NP1 = P, graphical picking is enabled and all remaining command - fields are ignored (valid only in the GUI). A component name may - also be substituted for NP1 (NP2 and NINC are ignored). - - kinc - Keypoint increment between sets. If zero, the lowest available - keypoint numbers are assigned [NUMSTR]. - - noelem - Specifies whether nodes and elements are also to be generated: - - 0 - Generate nodes and point elements associated with the original keypoints, if - they exist. - - 1 - Do not generate nodes and elements. - - imove - Specifies whether keypoints will be moved or newly defined: - - 0 - Generate additional keypoints. - - 1 - Move original keypoints to new position retaining the same keypoint numbers - (KINC and NOELEM are ignored). Valid only if the old keypoints - are no longer needed at their original positions. - Corresponding meshed items are also moved if not needed at - their original position. - - Notes - ----- - Transfers a pattern of keypoints (and corresponding mesh) from one - coordinate system to another (see analogous node transfer command, - TRANSFER). The MAT, TYPE, REAL, and ESYS attributes are based upon the - keypoints in the pattern and not upon the current settings. Coordinate - systems may be translated and rotated relative to each other. Initial - pattern may be generated in any coordinate system. Coordinate values - are interpreted in the active coordinate system and are transferred - directly. Solid modeling in a toroidal coordinate system is not - recommended. - """ - command = f"KTRAN,{kcnto},{np1},{np2},{ninc},{kinc},{noelem},{imove}" - return self.run(command, **kwargs) - - def source(self, x="", y="", z="", **kwargs): - """Defines a default location for undefined nodes or keypoints. - - APDL Command: SOURCE - - Parameters - ---------- - x, y, z - Global Cartesian coordinates for source nodes or keypoints - (defaults to the origin). - - Notes - ----- - Defines a global Cartesian location for undefined nodes or keypoints - moved during intersection calculations [MOVE or KMOVE]. - """ - command = f"SOURCE,{x},{y},{z}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/lines.py b/src/ansys/mapdl/core/_commands/preproc/lines.py deleted file mode 100644 index a0a85facd26..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/lines.py +++ /dev/null @@ -1,1488 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from ansys.mapdl.core._commands import parse - - -class Lines: - def bsplin( - self, - p1="", - p2="", - p3="", - p4="", - p5="", - p6="", - xv1="", - yv1="", - zv1="", - xv6="", - yv6="", - zv6="", - **kwargs, - ) -> int: - """Generate a single line from a spline fit to a series of keypoints. - - APDL Command: BSPLIN - - Parameters - ---------- - p1, p2, p3, p4, p5, p6 - Keypoints through which a spline is fit. At least two - keypoints must be defined. - - XV1, YV1, ZV1 - Orientation point of an outward vector tangent to line at - P1. Vector coordinate system has its origin at the - keypoint. Coordinate interpretation corresponds to the - active coordinate system type, i.e., X is R for - cylindrical, etc. Defaults to zero curvature slope. - - XV6, YV6, ZV6 - Orientation point of an outward vector tangent to a line - at P6 (or the last keypoint specified if fewer than six - specified). Defaults to zero curvature slope. - - Returns - ------- - int - Line number of the spline generated from the spline fit. - - Notes - ----- - One line is generated between keypoint P1 and the last - keypoint entered. The line will pass through each entered - keypoint. Solid modeling in a toroidal coordinate system is - not recommended. - - Examples - -------- - Generate a spline through ``(0, 0, 0)``, ``(0, 1, 0)`` and - ``(1, 2, 0)`` - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 1, 0) - >>> k2 = mapdl.k("", 1, 2, 0) - >>> lnum = mapdl.bsplin(k0, k1, k2) - """ - command = ( - f"BSPLIN,{p1},{p2},{p3},{p4},{p5},{p6},{xv1},{yv1},{zv1},{xv6},{yv6},{zv6}" - ) - return parse.parse_line_no(self.run(command, **kwargs)) - - def circle( - self, pcent="", rad="", paxis="", pzero="", arc="", nseg="", **kwargs - ) -> list: - """Generate circular arc lines. - - APDL Command: CIRCLE - - Generates circular arc lines (and their corresponding - keypoints). Keypoints are generated at regular angular - locations (based on a maximum spacing of 90 degrees). Arc lines are - generated connecting the keypoints. Keypoint and line numbers - are automatically assigned, beginning with the lowest - available values [NUMSTR]. Adjacent lines use a common - keypoint. Line shapes are generated as arcs, regardless of - the active coordinate system. Line shapes are invariant with - coordinate system after they are generated. - - Parameters - ---------- - pcent - Keypoint defining the center of the circle (in the plane - of the circle). - - rad - Radius of the circle. If RAD is blank and PCENT = P, the - radius is the distance from PCENT to PZERO. - - paxis - Keypoint defining axis of circle (along with PCENT). If - PCENT = P and PAXIS is omitted, the axis is normal to the - working plane. - - pzero - Keypoint defining the plane normal to circle (along with - PCENT and PAXIS) and the zero degree location. Need not - be in the plane of the circle. This value is not required - if PAXIS is defined along the Y axis (that is, a circle in - the XZ plane). - - arc - Arc length (in degrees). Positive follows right-hand rule - about PCENT-PAXIS vector. Defaults to 360 degrees. - - nseg - Number of lines around circumference (defaults to minimum - required for 90 degrees-maximum arcs, i.e., 4 for 360 degrees). Number - of keypoints generated is NSEG for 360 degrees or NSEG + 1 for - less than 360 degrees. - - Returns - ------- - list - List of lines of the circular arcs generated from this - command. - - Examples - -------- - Create a full circle containing four circular arcs. Circle - centered at (0, 0, 0) and generated in the XY plane. Return - the lines generated from the circle. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 0, 1) - >>> carc0 = mapdl.circle(k0, 1, k1) - >>> carc0 - [1, 2, 3, 4] - """ - command = f"CIRCLE,{pcent},{rad},{paxis},{pzero},{arc},{nseg}" - return parse.parse_line_nos(self.run(command, **kwargs)) - - def l( - self, - p1="", - p2="", - ndiv="", - space="", - xv1="", - yv1="", - zv1="", - xv2="", - yv2="", - zv2="", - **kwargs, - ) -> int: - """Define a line between two keypoints. - - APDL Command: L - - Defines a line between two keypoints from P1 to P2. The line - shape may be generated as "straight" (in the active coordinate - system) or curved. The line shape is invariant with - coordinate system after it is generated. Note that solid - modeling in a toroidal coordinate system is not recommended. - A curved line is limited to 180 degrees. Lines may be redefined only - if not yet attached to an area. - - Parameters - ---------- - p1 - Keypoint at the beginning of line. - - p2 - Keypoint at the end of line. - - ndiv - Number of element divisions within this line. Normally - this field is not used; specifying divisions with LESIZE, - etc. is recommended. - - space - Spacing ratio. Normally this field is not used, as - specifying spacing ratios with the LESIZE command is - recommended. If positive, space is the nominal ratio of - the last division size (at P2) to the first division size - (at P1). If the ratio is greater than 1, the division - sizes increase from P1 to P2, and if less than 1, they - decrease. If space is negative, then ``space`` is the - nominal ratio of the center division size to those at the - ends. - - Returns - ------- - int - The line number of the generated line. - - Examples - -------- - Create a line between the two keypoints (0, 0, 0) and (1, 0, 0) - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> lnum = mapdl.l(k0, k1) - >>> lnum - 1 - """ - command = f"L,{p1},{p2},{ndiv},{space},{xv1},{yv1},{zv1},{xv2},{yv2},{zv2}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def l2ang( - self, nl1="", nl2="", ang1="", ang2="", phit1="", phit2="", **kwargs - ) -> int: - """Generates a line at an angle with two existing lines. - - APDL Command: L2ANG - - Generates a straight line (PHIT1-PHIT2) at an angle (ANG1) - with an existing line NL1 (P1-P2) and which is also at an - angle (ANG2) with another existing line NL2 (P3-P4). If the - angles are zero the generated line is tangent to the two - lines. The PHIT1 and PHIT2 locations on the lines are - automatically calculated. Line P1-P2 becomes P1-PHIT1, P3-P4 - becomes P3-PHIT2, and new lines PHIT1-P2, PHIT2-P4, and - PHIT1-PHIT2 are generated. Line divisions are set to zero - (use LESIZE, etc. to modify). - - Parameters - ---------- - nl1 - Number of the first line to be hit (touched by the end of - the new line). If negative, assume P1 (see below) is the - second keypoint of the line instead of the first. - - nl2 - Number of the second line to be hit. If negative, assume - P3 is the second keypoint of the line instead of the - first. - - ang1 - Angle of intersection (usually zero or 180) of generated - line with tangent to first line. - - ang2 - Angle of intersection (usually zero or 180) of generated - line with tangent to second line. - - phit1 - Number to be assigned to keypoint generated at hit - location on first line (defaults to lowest available - keypoint number [NUMSTR]). - - phit2 - Number to be assigned to keypoint generated at hit - location on second line (defaults to lowest available - keypoint number [NUMSTR]). - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Create two circles and join them with a line. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 0, 1) - >>> k2 = mapdl.k("", 0, 0, 0.5) - >>> carc0 = mapdl.circle(k0, 1, k1) - >>> carc1 = mapdl.circle(k2, 1, k1) - >>> lnum = mapdl.l2ang(carc0[0], carc1[0], 90, 90) - >>> lnum - 9 - """ - command = f"L2ANG,{nl1},{nl2},{ang1},{ang2},{phit1},{phit2}" - msg = self.run(command, **kwargs) - if msg: - return parse.parse_line_no(msg) - - def l2tan(self, nl1="", nl2="", **kwargs) -> int: - """Generates a line tangent to two lines. - - APDL Command: L2TAN - - Generates a line (P2-P3) tangent at point P2 to line NL1 - (P1-P2) and tangent at point P3 to line NL2 (P3-P4). - - Parameters - ---------- - nl1 - Number of the first line generated line is tangent to. If - negative, assume P1 (see below) is the second keypoint of - the line instead of the first. - - nl2 - Number of the second line generated line is tangent to. - If negative, assume P3 is the second keypoint of the line - instead of the first. - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Create two circular arcs and connect them with a spline. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 0, 1) - >>> k2 = mapdl.k("", -1.5, 1.5, 0) - >>> k3 = mapdl.k("", -1.5, 1.5, 1) - >>> carc0 = mapdl.circle(k0, 1, k1, arc=90) - >>> carc1 = mapdl.circle(k2, 1, k3, arc=90) - >>> lnum = mapdl.l2tan(1, 2) - 3 - - Plot these lines - - >>> mapdl.lplot(cpos='xy') - """ - command = f"L2TAN,{nl1},{nl2}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def lang(self, nl1="", p3="", ang="", phit="", locat="", **kwargs) -> int: - """Generate a straight line at an angle with a line. - - APDL Command: LANG - - Generates a straight line (PHIT-P3) at an angle (ANG) with a - line NL1 (P1-P2). The location of PHIT on the line is - automatically calculated. Line P1-P2 becomes P1-PHIT and new - lines PHIT-P2 and PHIT-P3 are generated. Line divisions are - set to zero (use LESIZE, etc. to modify). - - PHIT is positioned closest to LOCAT for the given angle, ANG. - To ensure better performance, it is recommended that LOCAT be - input, even if it is 0. - - The program uses an iterative procedure to position PHIT. The - procedure is not exact, with the result that the actual value - of ANG will sometimes differ slightly from the specified - value. - - Parameters - ---------- - nl1 - Number of the line to be hit (touched by the end of the - new line). If negative, assume P1 (see below) is the - second keypoint of the line instead of the first. - - p3 - Keypoint at which generated line must end. - - ang - Angle of intersection of generated line PHIT-P3 with - tangent to line P1-P2 at PHIT. If 0 (default), the - generated line is tangent to NL1 toward end P1; if 90, the - generated line is perpendicular to NL1. If 180, the - generated line is tangent to NL1 toward end P2. ANG can - be any value, but is adjusted to the corresponding acute - angle with respect to LOCAT. See "Notes" for a discussion - of accuracy. - - phit - Number to be assigned to keypoint generated at hit - location (defaults to lowest available keypoint number - [NUMSTR]). - - locat - Approximate location of PHIT in terms of the ratio of the - distance along the line (NL1) to the length of the line. - LOCAT can range from 0 to 1. If LOCAT is blank, the point - will be located with less speed and accuracy, and an - arbitrary location may result. - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Create a line from a line from (0, 0, 0) to (1, 0, 0) to a - keypoint at (1, 1, 1) at an angle of 60 degrees. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> lnum = mapdl.l(k0, k1) - >>> k2 = mapdl.k("", 1, 1, 0) - >>> lnum = mapdl.lang(lnum, k2, 60) - >>> lnum - 2 - """ - command = f"LANG,{nl1},{p3},{ang},{phit},{locat}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def larc(self, p1="", p2="", pc="", rad="", **kwargs) -> int: - """Define a circular arc. - - APDL Command: LARC - - Defines a circular arc line from P1 to P2. The line shape is - generated as circular, regardless of the active coordinate - system. The line shape is invariant with coordinate system - after it is generated. - - When dealing with a large radius arc (1e3), or if the location - of the arc you create is far away from the origin of your - coordinate system, anomalies may occur. You can prevent this - by creating the arc at a smaller scale, and then scaling the - model back to full size (LSSCALE). - - Parameters - ---------- - p1 - Keypoint at one end of circular arc line. - - p2 - Keypoint at other end of circular arc line. - - pc - Keypoint defining plane of arc and center of curvature - side (with positive radius). Must not lie along the - straight line from P1 to P2. PC need not be at the center - of curvature. - - rad - Radius of curvature of the arc. If negative, assume - center of curvature side is opposite to that defined by - PC. If RAD is blank, RAD will be calculated from a curve - fit through P1, PC, and P2. - - Returns - ------- - int - Line number of the arc. - - Examples - -------- - Create a circular arc that travels between (0, 0, 0) and - (1, 1, 0) with a radius of curvature of 2. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 1, 0) - >>> k2 = mapdl.k("", 0, 1, 0) - >>> lnum = mapdl.larc(k0, k1, k2, 2) - 1 - """ - command = f"LARC,{p1},{p2},{pc},{rad}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def larea(self, p1="", p2="", narea="", **kwargs) -> int: - """Generate the shortest line between two keypoints on an area. - - APDL Command: LAREA - - Generates the shortest line between two keypoints, P1 and P2, - both of which lie on an area. The generated line will also - lie on the area. P1 and P2 may also be equidistant (in global - Cartesian space) from the area (and on the same side of the - area), in which case a line parallel to the area is generated. - - Parameters - ---------- - p1 - First keypoint of line to be generated. - - p2 - Second keypoint of line to be generated. - - narea - Area containing P1 and P2, or area to which generated line - is to be parallel. - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Generate a line on a square between its two corners. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> k2 = mapdl.k("", 1, 1, 0) - >>> k3 = mapdl.k("", 0, 1, 0) - >>> a0 = mapdl.a(k0, k1, k2, k3) - >>> lnum = mapdl.larea(k0, k2, a0) - >>> lnum - 1 - """ - command = f"LAREA,{p1},{p2},{narea}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def lcomb(self, nl1="", nl2="", keep="", **kwargs) -> int: - """Combines adjacent lines into one line. - - APDL Command: LCOMB - - Combines adjacent lines into one line (the output line). This - operation will effectively "undo" the LDIV operation. Line - divisions are set to zero (use LESIZE, etc. to modify). Lines - attached to the same area(s) can also be combined. See also - the LCCAT command for line concatenation capability. - - Parameters - ---------- - nl1 - Number of the first line to be combined. If NL1 = ALL, - NL2 is ignored and all selected lines [LSEL] are combined. - A component name may also be substituted for NL1 (NL2 is - ignored). - - nl2 - Number of the second line to be combined. - - keep - Specifies whether to keep the input entities: - - 0 - Delete lines NL1 and NL2 and their common keypoint. - Keypoints will not be deleted if they are meshed or if - they are attached to other lines. Lines will not be - deleted if they are attached to different areas. - - 1 - Keep NL1, NL2, and their common keypoint. (The common - keypoint will not be attached to the output line.) - - Returns - ------- - int - Line number of the combined line. - - Examples - -------- - Create two lines and combine them. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> k2 = mapdl.k("", 2, 0, 0) - >>> l0 = mapdl.l(k0, k1) - >>> l1 = mapdl.l(k0, k2) - >>> lout = mapdl.lcomb(l0, l1) - >>> lout - 1 - """ - command = f"LCOMB,{nl1},{nl2},{keep}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def ldele(self, nl1="", nl2="", ninc="", kswp="", **kwargs): - """Deletes unmeshed lines. - - APDL Command: LDELE - - Parameters - ---------- - nl1, nl2, ninc - Delete lines from NL1 to NL2 (defaults to NL1) in steps of NINC - (defaults to 1). If NL1 = ALL, NL2 and NINC are ignored and all - selected lines [LSEL] are deleted. If NL1 = P, graphical picking - is enabled and all remaining command fields are ignored (valid only - in the GUI). A component name may also be substituted for NL1 (NL2 - and NINC are ignored). - - kswp - Specifies whether keypoints are also to be deleted: - - 0 - Delete lines only. - - 1 - Delete lines, as well as keypoints attached to lines but not attached to other - lines. - - Notes - ----- - A line attached to an area cannot be deleted unless the area is first - deleted. - """ - command = f"LDELE,{nl1},{nl2},{ninc},{kswp}" - return self.run(command, **kwargs) - - def ldiv(self, nl1="", ratio="", pdiv="", ndiv="", keep="", **kwargs) -> str: - """Divides a single line into two or more lines. - - APDL Command: LDIV - - Divides a single line NL1 (defined from keypoint P1 to - keypoint P2) into two or more lines. Line NL1 becomes the new - line beginning with keypoint P1 and new lines are generated - ending at keypoint P2. If the line is attached to an area, - the area will also be updated. Line divisions are set to zero - (use LESIZE, etc. to modify). - - Parameters - ---------- - nl1 - Number of the line to be divided. If negative, assume P1 - (see below) is the second keypoint of the line instead of - the first for RATIO. If ALL, divide all selected lines - [LSEL]. A component name may also be substituted for NL1. - - ratio - Ratio of line length P1-PDIV to line length P1-P2. Must - be between 0.0 and 1.0. Input ignored if NDIV > 2. - - pdiv - Number to be assigned to keypoint generated at division - location (defaults to lowest available keypoint number - [NUMSTR]). Input ignored if NL1 = ALL or NDIV > 2. If - PDIV already exists and lies on line NL1, divide line at - PDIV (RATIO must also be 0.0). If PDIV already exists and - does not lie on line NL1, PDIV is projected and moved to - the nearest point on line NL1 (if possible). PDIV cannot - be attached to another line, area, or volume. - - ndiv - The number of new lines to be generated from old line - (defaults to 2). - - keep - Specifies whether to keep the input entities: - - 0 - Modify old line to use new keypoints and slopes. - - 1 - Do not modify old line. New lines will overlay old - line and have unique keypoints. - - Returns - ------- - str - MAPDL command output. - - Examples - -------- - Create a single line and divide it exactly half. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> l0 = mapdl.l(k0, k1) - >>> output = mapdl.ldiv(l0, ratio=0.5) - >>> print(output) - DIVIDE LINE 1 RATIO= 0.50000 NEW KEYPOINT= 0 - NUMBER OF LINES DIVIDED = 1 - - - Create a single line and divide it into 5 pieces. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 0, 0) - >>> l0 = mapdl.l(k0, k1) - >>> mapdl.ldiv(l0, ndiv=5) - """ - command = f"LDIV,{nl1},{ratio},{pdiv},{ndiv},{keep}" - return self.run(command, **kwargs) - - def ldrag( - self, - nk1="", - nk2="", - nk3="", - nk4="", - nk5="", - nk6="", - nl1="", - nl2="", - nl3="", - nl4="", - nl5="", - nl6="", - **kwargs, - ): - """Generates lines by sweeping a keypoint pattern along path. - - APDL Command: LDRAG - - Parameters - ---------- - nk1, nk2, nk3, . . . , nk6 - List of keypoints in the pattern to be dragged (6 maximum if using - keyboard entry). If NK1 = P, graphical picking is enabled and all - remaining command fields are ignored (valid only in the GUI). If - NK1 = ALL, all selected keypoints (except those that define the - drag path) will be swept along the path. A component name may also - be substituted for NK1. - - nl1, nl2, nl3, . . . , nl6 - List of lines defining the path along which the pattern is to be - dragged (6 maximum if using keyboard entry). Must be a continuous - set of lines. - - Notes - ----- - Generates lines (and their corresponding keypoints) by sweeping a given - keypoint pattern along a characteristic drag path. If the drag path - consists of multiple lines, the drag direction is determined by the - sequence in which the path lines are input (NL1, NL2, etc.). If the - drag path is a single line (NL1), the drag direction is from the - keypoint on the drag line that is closest to the first keypoint of the - given pattern to the other end of the drag line. - - The magnitude of the vector between the keypoints of the given pattern - and the first path keypoint remains constant for all generated keypoint - patterns and the path keypoints. The direction of the vector relative - to the path slope also remains constant so that patterns may be swept - around curves. Keypoint and line numbers are automatically assigned - (beginning with the lowest available values [NUMSTR]). For best - results, the entities to be dragged should be orthogonal to the start - of the drag path. Drag operations that produce an error message may - create some of the desired entities prior to terminating. - """ - command = f"LDRAG,{nk1},{nk2},{nk3},{nk4},{nk5},{nk6},{nl1},{nl2},{nl3},{nl4},{nl5},{nl6}" - return self.run(command, **kwargs) - - def lextnd(self, nl1="", nk1="", dist="", keep="", **kwargs) -> int: - """Extends a line at one end by using its slope. - - APDL Command: LEXTND - - Extends a line at one end by using its slope. Lines may be - redefined only if not yet attached to an area. Line divisions - are set to zero (use LESIZE, etc. to modify). Note that solid - modeling in a toroidal coordinate system is not recommended. - - Parameters - ---------- - nl1 - Number of the line to be extended. - - nk1 - Number of keypoint at the end of line NL1 to be extended. - - dist - Distance that the line will be extended. - - keep - Specifies whether to keep the input entities: - - 0 - Modify old line to use new keypoints and slopes. - - 1 - Do not modify old line. New line will overlay old - line and have unique keypoints. - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Create a circular arc and extend it at one of its keypoints - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 0, 1) - >>> carcs = mapdl.circle(k0, 1, k1, arc=90) - >>> lnum = mapdl.lextnd(carcs[0], 3, 1) - >>> lnum - 1 - """ - command = f"LEXTND,{nl1},{nk1},{dist},{keep}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def lfillt(self, nl1="", nl2="", rad="", pcent="", **kwargs) -> int: - """Generate a fillet line between two intersecting lines. - - APDL Command: LFILLT - - Generates a fillet line between two intersecting lines NL1 - (P1-PINT) and NL2 (P2-PINT). Three keypoints may be - generated, two at the fillet tangent points (PTAN1 and PTAN2) - and one (optional) at the fillet arc center (PCENT). Line - P1-PINT becomes P1-PTAN1, P2-PINT becomes P2-PTAN2, and new - arc line PTAN1-PTAN2 is generated. Generated keypoint and - line numbers are automatically assigned (beginning with the - lowest available values [NUMSTR]). Line divisions are set to - zero (use LESIZE, etc. to modify). - - Parameters - ---------- - nl1 - Number of the first intersecting line. - - nl2 - Number of the second intersecting line. - - rad - Radius of fillet to be generated. Radius should be less than the - lengths of the two lines specified with NL1 and NL2. - - pcent - Number to be assigned to generated keypoint at fillet arc center. - If zero (or blank), no keypoint is generated. - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Create two intersecting lines at a right angle and add a - fillet between them. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 1, 0) - >>> k2 = mapdl.k("", 1, 0, 0) - >>> l0 = mapdl.l(k0, k1) - >>> l1 = mapdl.l(k0, k2) - >>> lnum = mapdl.lfillt(l0, l1, 0.25) - 3 - """ - command = f"LFILLT,{nl1},{nl2},{rad},{pcent}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def lgen( - self, - itime="", - nl1="", - nl2="", - ninc="", - dx="", - dy="", - dz="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Generates additional lines from a pattern of lines. - - APDL Command: LGEN - - Parameters - ---------- - itime - Do this generation operation a total of ITIMEs, incrementing all - keypoints in the given pattern automatically (or by KINC) each time - after the first. ITIME must be > 1 for generation to occur. - - nl1, nl2, ninc - Generate lines from pattern beginning with NL1 to NL2 (defaults to - NL1) in steps of NINC (defaults to 1). If NL1 = ALL, NL2 and NINC - are ignored and pattern is all selected lines [LSEL]. If NL1 = P, - graphical picking is enabled and all remaining command fields are - ignored (valid only in the GUI). A component name may also be - substituted for NL1 (NL2 and NINC are ignored). - - dx, dy, dz - Keypoint location increments in the active coordinate system (--, - Dθ, DZ for cylindrical, --, Dθ, -- for spherical). - - kinc - Keypoint increment between generated sets. If zero, the lowest - available keypoint numbers are assigned [NUMSTR]. - - noelem - Specifies if elements and nodes are also to be generated: - - 0 - Generate nodes and elements associated with the original lines, if they exist. - - 1 - Do not generate nodes and elements. - - imove - Specifies whether to redefine the existing lines: - - 0 - Generate additional lines as requested with the ITIME argument. - - 1 - Move original lines to new position retaining the same keypoint numbers (ITIME, - KINC, and NOELM are ignored). Valid only if the old lines are - no longer needed at their original positions. Corresponding - meshed items are also moved if not needed at their original - position. - - Notes - ----- - Generates additional lines (and their corresponding keypoints and mesh) - from a given line pattern. The MAT, TYPE, REAL, and ESYS attributes - are based upon the lines in the pattern and not upon the current - settings. End slopes of the generated lines remain the same (in the - active coordinate system) as those of the given pattern. For example, - radial slopes remain radial, etc. Generations which produce lines of a - size or shape different from the pattern (i.e., radial generations in - cylindrical systems, radial and phi generations in spherical systems, - and theta generations in elliptical systems) are not allowed. Note - that solid modeling in a toroidal coordinate system is not recommended. - New line numbers are automatically assigned (beginning with the lowest - available values [NUMSTR]). - """ - command = ( - f"LGEN,{itime},{nl1},{nl2},{ninc},{dx},{dy},{dz},{kinc},{noelem},{imove}" - ) - return self.run(command, **kwargs) - - def llist(self, nl1="", nl2="", ninc="", lab="", **kwargs): - """Lists the defined lines. - - APDL Command: LLIST - - Parameters - ---------- - nl1, nl2, ninc - List lines from NL1 to NL2 (defaults to NL1) in steps of NINC - (defaults to 1). If NL1 = ALL (default), NL2 and NINC are ignored - and all selected lines [LSEL] are listed. If NL1 = P, graphical - picking is enabled and all remaining command fields are ignored - (valid only in the GUI). A component name may also be substituted - for NL1 (NL2 and NINC are ignored). - - lab - Determines what type of listing is used (one of the following): - - (blank) - Prints information about all lines in the specified range. - - RADIUS - Prints the radius of certain circular arcs, along with the keypoint numbers of - each line. Straight lines, non-circular curves, and - circular arcs not internally identified as arcs (which - depends upon how each arc is created) will print a radius - value of zero. - - LAYER - Prints layer-mesh control specifications. - - HPT - Prints information about only those lines that contain hard points. HPT is not - supported in the GUI. - - ORIENT - Prints a list of lines, and identifies any orientation keypoints and any cross - section IDs that are associated with the lines. Used for - beam meshing with defined orientation nodes and cross - sections. - - Notes - ----- - There are 2 listings for the number of element divisions and the - spacing ratio. The first listing shows assignments from LESIZE only, - followed by the "hard" key (KYNDIV). See LESIZE for more information. - The second listing shows NDIV and SPACE for the existing mesh, if one - exists. Whether this existing mesh and the mesh generated by LESIZE - match at any given point depends upon meshing options and the sequence - of meshing operations. - - A "-1" in the "nodes" column indicates that the line has been meshed - but that there are no interior nodes. - - An attribute (TYPE, MAT, REAL, or ESYS) listed as a zero is unassigned; - one listed as a positive value indicates that the attribute was - assigned with the LATT command (and will not be reset to zero if the - mesh is cleared); one listed as a negative value indicates that the - attribute was assigned using the attribute pointer [TYPE, MAT, REAL, or - ESYS] that was active during meshing (and will be reset to zero if the - mesh is cleared). - - This command is valid in any processor. - """ - command = f"LLIST,{nl1},{nl2},{ninc},{lab}" - return self.run(command, **kwargs) - - def lplot(self, nl1="", nl2="", ninc="", **kwargs): - """Displays the selected lines. - - APDL Command: LPLOT - - Parameters - ---------- - nl1, nl2, ninc - Display lines from NL1 to NL2 (defaults to NL1) in steps of NINC - (defaults to 1). If NL1 = ALL (default), NL2 and NINC are ignored - and display all selected lines [LSEL]. - - Notes - ----- - Mesh divisions on plotted lines are controlled by the LDIV option of - the /PSYMB command. - - This command is valid in any processor. - """ - command = f"LPLOT,{nl1},{nl2},{ninc}" - return self.run(command, **kwargs) - - def lreverse(self, lnum="", noeflip="", **kwargs): - """Reverses the normal of a line, regardless of its connectivity or mesh - - APDL Command: LREVERSE - status. - - Parameters - ---------- - lnum - Line number of the line whose normal direction is to be reversed. - If LNUM = ALL, the normals of all selected lines will be reversed. - If LNUM = P, graphical picking is enabled. A component name may - also be substituted for LNUM. - - noeflip - Indicates whether you want to change the normal direction of the - existing elements on the reversed line(s) so that they are - consistent with each line's new normal direction. - - 0 - Make the normal direction of existing elements on the reversed line(s) - consistent with each line's new normal direction (default). - - 1 - Do not change the normal direction of existing elements on the reversed - line(s). - - Notes - ----- - You cannot use the LREVERSE command to change the normal direction of - any element that has a body or surface load. We recommend that you - apply all of your loads only after ensuring that the element normal - directions are acceptable. - - Real constants (such as nonuniform shell thickness and tapered beam - constants) may be invalidated by an element reversal. - - For more information, see Revising Your Model in the Modeling and - Meshing Guide. - """ - command = f"LREVERSE,{lnum},{noeflip}" - return self.run(command, **kwargs) - - def lrotat( - self, - nk1="", - nk2="", - nk3="", - nk4="", - nk5="", - nk6="", - pax1="", - pax2="", - arc="", - nseg="", - **kwargs, - ): - """Generates circular lines by rotating a keypoint pattern about an axis. - - APDL Command: LROTAT - - Parameters - ---------- - nk1, nk2, nk3, . . . , nk6 - List of keypoints in the pattern to be rotated (6 maximum if using - keyboard entry). If NK1 = P, graphical picking is enabled and all - remaining command fields are ignored (valid only in the GUI). If - NK1 = ALL, all selected keypoints (except PAX1 and PAX2) will - define the pattern to be rotated. A component name may also be - substituted for NK1. - - pax1, pax2 - Keypoints defining the axis about which the keypoint pattern is to - be rotated. - - arc - Arc length (in degrees). Positive follows right-hand rule about - PAX1-PAX2 vector. Defaults to 360. - - nseg - Number of lines (8 maximum) around circumference. Defaults to - minimum required for 90° (maximum) arcs, i.e., 4 for 360°, 3 for - 270°, etc. - - Notes - ----- - Generates circular lines (and their corresponding keypoints) by - rotating a keypoint pattern about an axis. Keypoint patterns are - generated at regular angular locations (based on a maximum spacing of - 90°). Line patterns are generated at the keypoint patterns. Keypoint - and line numbers are automatically assigned (beginning with the lowest - available values [NUMSTR]). - """ - command = ( - f"LROTAT,{nk1},{nk2},{nk3},{nk4},{nk5},{nk6},{pax1},{pax2},{arc},{nseg}" - ) - return self.run(command, **kwargs) - - def lsscale( - self, - nl1="", - nl2="", - ninc="", - rx="", - ry="", - rz="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Generates a scaled set of lines from a pattern of lines. - - APDL Command: LSSCALE - - Parameters - ---------- - nl1, nl2, ninc - Set of lines (NL1 to NL2 in steps of NINC) that defines the pattern - to be scaled. NL2 defaults to NL1, NINC defaults to 1. If NL1 = - ALL, NL2 and NINC are ignored and the pattern is defined by all - selected lines. If NL1 = P, graphical picking is enabled and all - remaining command fields are ignored (valid only in the GUI). A - component name may also be substituted for NL1 (NL2 and NINC are - ignored). - - rx, ry, rz - Scale factors to be applied to the X, Y, Z keypoint coordinates in - active coordinate system (RR, Rθ, RZ for cylindrical; RR, Rθ, RΦ - for spherical). Note that the Rθ and RΦ scale factors are - interpreted as angular offsets. For example, for CSYS,1, RR, Rθ, - RZ input of (1.5,10,3) would scale the specified keypoints 1.5 - times in the radial and 3 times in the Z direction, while adding an - offset of 10 degrees to the keypoints. Zero, blank, or negative - scale factor values are assumed to be 1.0. Zero or blank angular - offsets have no effect. - - kinc - Increment to be applied to keypoint numbers for generated set. If - zero, the lowest available keypoint numbers will be assigned - [NUMSTR]. - - noelem - Specifies whether nodes and elements are also to be generated: - - 0 - Nodes and line elements associated with the original lines will be generated - (scaled) if they exist. - - 1 - Nodes and line elements will not be generated. - - imove - Specifies whether lines will be moved or newly defined: - - 0 - Additional lines will be generated. - - 1 - Original lines will be moved to new position (KINC and NOELEM are ignored). - Use only if the old lines are no longer needed at their - original positions. Corresponding meshed items are also moved - if not needed at their original position. - - Notes - ----- - Generates a scaled set of lines (and their corresponding keypoints and - mesh) from a pattern of lines. The MAT, TYPE, REAL, and ESYS - attributes are based on the lines in the pattern and not the current - settings. Scaling is done in the active coordinate system. Lines in - the pattern could have been generated in any coordinate system. - """ - command = f"LSSCALE,{nl1},{nl2},{ninc},{rx},{ry},{rz},{kinc},{noelem},{imove}" - return self.run(command, **kwargs) - - def lstr(self, p1="", p2="", **kwargs) -> int: - """Define a straight line irrespective of the active coordinate system. - - APDL Command: LSTR - - Defines a straight line from P1 to P2 using the global - Cartesian coordinate system. The active coordinate system - will be ignored. The line shape is invariant with the - coordinate system after it is generated. Lines may be - redefined only if not yet attached to an area. - - Parameters - ---------- - p1 - Keypoint at the beginning of line. - - p2 - Keypoint at the end of line. - - Returns - ------- - int - Line number of the generated line. - - Examples - -------- - Create a cartesian straight line regardless of the coordinate - system being in cylindrical. - - >>> mapdl.csys(1) - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 1, 1, 1) - >>> lnum = mapdl.lstr(k0, k1) - >>> lnum - 1 - """ - command = f"LSTR,{p1},{p2}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def lsum(self, **kwargs): - """Calculates and prints geometry statistics of the selected lines. - - APDL Command: LSUM - - Notes - ----- - Calculates and prints geometry statistics (length, centroid, moments of - inertia, etc.) associated with the selected lines. Geometry items are - reported in the global Cartesian coordinate system. A unit density is - assumed, irrespective of any material associations [LATT, MAT]. Items - calculated by LSUM and later retrieved by a ``*GET`` or ``*VGET`` command are - valid only if the model is not modified after the LSUM command is - issued. - """ - command = f"LSUM," - return self.run(command, **kwargs) - - def lsymm( - self, - ncomp="", - nl1="", - nl2="", - ninc="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Generates lines from a line pattern by symmetry reflection. - - APDL Command: LSYMM - - Parameters - ---------- - ncomp - Symmetry key: - - X - X symmetry (default). - - Y - Y symmetry. - - Z - Z symmetry. - - nl1, nl2, ninc - Reflect lines from pattern beginning with NL1 to NL2 (defaults to - NL1) in steps of NINC (defaults to 1). If NL1 = ALL, NL2 and NINC - are ignored and pattern is all selected lines [LSEL]. If NL1 = P, - graphical picking is enabled and all remaining command fields are - ignored (valid only in the GUI). A component name may also be - substituted for NL1 (NL2 and NINC are ignored). - - kinc - Keypoint increment between sets. If zero, the lowest available - keypoint numbers are assigned [NUMSTR]. - - noelem - Specifies whether nodes and elements are also to be generated: - - 0 - Generate nodes and elements associated with the original lines, if they exist. - - 1 - Do not generate nodes and elements. - - imove - Specifies whether areas will be moved or newly defined: - - 0 - Generate additional lines. - - 1 - Move original lines to new position retaining the same keypoint numbers (KINC - and NOELEM are ignored). Valid only if the old lines are no - longer needed at their original positions. Corresponding - meshed items are also moved if not needed at their original - position. - - Notes - ----- - Generates a reflected set of lines (and their corresponding keypoints - and mesh) from a given line pattern by a symmetry reflection (see - analogous node symmetry command, NSYM). The MAT, TYPE, REAL, and ESYS - attributes are based upon the lines in the pattern and not upon the - current settings. Reflection is done in the active coordinate system - by changing a particular coordinate sign. The active coordinate system - must be Cartesian. Lines in the pattern may have been generated in any - coordinate system. However, solid modeling in a toroidal coordinate - system is not recommended. Lines are generated as described in the - LGEN command. - - See the ESYM command for additional information about symmetry - elements. - """ - command = f"LSYMM,{ncomp},{nl1},{nl2},{ninc},{kinc},{noelem},{imove}" - return self.run(command, **kwargs) - - def ltan(self, nl1="", p3="", xv3="", yv3="", zv3="", **kwargs) -> int: - """Generate a line at the end of, and tangent to, an existing line. - - APDL Command: LTAN - - Generates a line (P2-P3) tangent at end point (P2) of line NL1 - (P1-P2). - - Parameters - ---------- - nl1 - Number of the line the generated line is tangent to. If - negative, assume P1 (see below), instead of P2, is the - second keypoint of line NL1. - - p3 - Keypoint at which generated line must end. - - Returns - ------- - int - Line number of the line generated. - - Examples - -------- - Create a circular arc and generate a tangent spline at the end - of it directed to a new keypoint. - - >>> k0 = mapdl.k("", 0, 0, 0) - >>> k1 = mapdl.k("", 0, 0, 1) - >>> k2 = mapdl.k("", -1, 1.5, 0) - >>> carc = mapdl.circle(k0, 1, k1, arc=90) - >>> lnum = mapdl.ltan(carc[0], k2) - >>> lnum - 2 - """ - command = f"LTAN,{nl1},{p3},{xv3},{yv3},{zv3}" - return parse.parse_line_no(self.run(command, **kwargs)) - - def ltran( - self, - kcnto="", - nl1="", - nl2="", - ninc="", - kinc="", - noelem="", - imove="", - **kwargs, - ): - """Transfers a pattern of lines to another coordinate system. - - APDL Command: LTRAN - - Parameters - ---------- - kcnto - Reference number of coordinate system where the pattern is to be - transferred. Transfer occurs from the active coordinate system. - The coordinate system type and parameters of KCNTO must be the same - as the active system. - - nl1, nl2, ninc - Transfer lines from pattern beginning with NL1 to NL2 (defaults to - NL1) in steps of NINC (defaults to 1). If NL1 = ALL, NL2 and NINC - are ignored and pattern is all selected lines [LSEL]. If NL1 = P, - graphical picking is enabled and all remaining command fields are - ignored (valid only in the GUI). A component name may also be - substituted for NL1 (NL2 and NINC are ignored). - - kinc - Keypoint increment between sets. If zero, the lowest available - keypoint numbers are assigned [NUMSTR]. - - noelem - Specifies whether nodes and elements are also to be generated: - - 0 - Generate nodes and elements associated with the original lines, if they exist. - - 1 - Do not generate nodes and elements. - - imove - Specifies whether lines will be moved or newly defined: - - 0 - Generate additional lines. - - 1 - Move original lines to new position retaining the same keypoint numbers (KINC - and NOELM are ignored). Valid only if the old lines are no - longer needed at their original positions. Corresponding - meshed items are also moved if not needed at their original - position. - - Notes - ----- - Transfers a pattern of lines (and their corresponding keypoints and - mesh) from one coordinate system to another (see analogous node - transfer command, TRANSFER). The MAT, TYPE, REAL, and ESYS attributes - are based upon the lines in the pattern and not upon the current - settings. Coordinate systems may be translated and rotated relative to - each other. Initial pattern may be generated in any coordinate system. - However, solid modeling in a toroidal coordinate system is not - recommended. Coordinate and slope values are interpreted in the active - coordinate system and are transferred directly. Lines are generated as - described in the LGEN command. - """ - command = f"LTRAN,{kcnto},{nl1},{nl2},{ninc},{kinc},{noelem},{imove}" - return self.run(command, **kwargs) - - def spline( - self, - p1="", - p2="", - p3="", - p4="", - p5="", - p6="", - xv1="", - yv1="", - zv1="", - xv6="", - yv6="", - zv6="", - **kwargs, - ) -> list: - """Generate a segmented spline through a series of keypoints. - - APDL Command: SPLINE - - The output from this command is a series of connected lines - (one line between each pair of keypoints) that together form a - spline. Note that solid modeling in a toroidal coordinate - system is not recommended. - - Parameters - ---------- - p1, p2, p3, . . . , p6 - Keypoints through which the spline is fit. At least two - must be defined. - - Returns - ------- - list - List of line numbers generated. - - Examples - -------- - Create a spline with 5 keypoints. - - >>> k0 = mapdl.k('', 0, 0, 0) - >>> k1 = mapdl.k('', 0.2, 0.2, 0) - >>> k2 = mapdl.k('', 0.4, 0.3, 0) - >>> k3 = mapdl.k('', 0.6, 0.5, 0) - >>> k4 = mapdl.k('', 0.8, 0.3, 0) - >>> lines = mapdl.spline(k0, k1, k2, k3, k4) - >>> lines - [1, 2, 3, 4] - """ - command = ( - f"SPLINE,{p1},{p2},{p3},{p4},{p5},{p6},{xv1},{yv1},{zv1},{xv6},{yv6},{zv6}" - ) - return parse.parse_line_nos(self.run(command, **kwargs)) - - def ssln(self, fact="", size="", **kwargs): - """Selects and displays small lines in the model. - - APDL Command: SSLN - - Parameters - ---------- - fact - Factor used to determine small lines. FACT times the average line - length in the model is used as the line length limit below which - lines will be selected. - - size - Line length limit for line selection. Lines that have a length - less than or equal to SIZE will be selected. Used only if FACT is - blank. - - Notes - ----- - SSLN invokes a predefined ANSYS macro for selecting small lines in a - model. Lines that are smaller than or equal to the specified limit - (FACT or SIZE) are selected and line numbers are displayed. This - command macro is useful for detecting very small lines in a model that - may cause problems (i.e., poorly shaped elements or a meshing failure) - during meshing. All lines that are not "small" will be unselected and - can be reselected with the LSEL command. - """ - command = f"SSLN,{fact},{size}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/material_data_tables.py b/src/ansys/mapdl/core/_commands/preproc/material_data_tables.py deleted file mode 100644 index 15eef221592..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/material_data_tables.py +++ /dev/null @@ -1,797 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -""" -These PREP7 commands create and modify the material data tables (that -is, to specify and define material models). -""" - - -class MaterialDataTables: - def tb( - self, - lab="", - mat="", - ntemp="", - npts="", - tbopt="", - eosopt="", - funcname="", - **kwargs, - ): - """APDL Command: TB - - Activates a data table for material properties or special element - input. - - Parameters - ---------- - lab - Material model data table type: - - AFDM - Acoustic frequency-dependent material. - - AHYPER - Anisotropic hyperelasticity. - - ANEL - Anisotropic elasticity. - - ANISO - Anisotropic plasticity. - - BB - Bergstrom-Boyce. - - BH - Magnetic field data. - - BISO - Bilinear isotropic hardening using von Mises or Hill plasticity. - - BKIN - Bilinear kinematic hardening using von Mises or Hill plasticity. - - CAST - Cast iron. - - CDM - Mullins effect (for isotropic hyperelasticity models). - - CGCR - Fracture criterion for crack-growth simulation (``CGROW``). - - CHABOCHE - Chaboche nonlinear kinematic hardening using von Mises or Hill plasticity. - - COMP - Composite damage (explicit dynamic analysis). - - CONCR - Concrete element data. - - CREEP - Creep. Pure creep, creep with isotropic hardening plasticity, or creep with - kinematic hardening plasticity using both von Mises or Hill - potentials. - - CTE - Secant coefficient of thermal expansion. - - CZM - Cohesive zone. - - DISCRETE - Explicit spring-damper (discrete). - - DMGE - Damage evolution law. - - DMGI - Damage initiation criteria. - - DP - Classic Drucker-Prager plasticity. - - DPER - Anisotropic electric permittivity. - - EDP - Extended Drucker-Prager (for granular materials such as rock, concrete, soil, - ceramics and other pressure-dependent materials). - - ELASTIC - Elasticity. For full harmonic analyses, properties can be defined as frequency- - or temperature-dependent (:meth:`TBFIELD `). - - EOS - Equation of state (explicit dynamic analysis). - - EVISC - Viscoelastic element data (explicit dynamic analysis). - - EXPE - Experimental data. - - FCON - Fluid conductance data (explicit dynamic analysis). - - FCLI - Material strength limits for calculating failure criteria. - - FLUID - Fluid. - - FOAM - Foam (explicit dynamic analysis). - - FRIC - Coefficient of friction based on Coulomb's Law or user-defined friction. - - GASKET - Gasket. - - GCAP - Geological cap (explicit dynamic analysis). - - GURSON - Gurson pressure-dependent plasticity for porous metals. - - HFLM - Film coefficient data. - - HILL - Hill anisotropy. When combined with other material options, simulates - plasticity, viscoplasticity, and creep -- all with the Hill - potential. - - HONEY - Honeycomb (explicit dynamic analysis). - - HYPER - Hyperelasticity material models (Arruda-Boyce, Blatz-Ko, Extended Tube, Gent, - Mooney-Rivlin [default], Neo-Hookean, Ogden, Ogden Foam, - Polynomial Form, Response Function, Yeoh, and user- - defined). - - INTER - Contact interaction. - - JOIN - Joint (linear and nonlinear elastic stiffness, linear and nonlinear damping, and frictional behavior). - - JROCK - Jointed rock. - - MC - Mohr-Coulomb. - - MELAS - Multilinear elasticity . - - MIGR - Migration. - - MPLANE - Microplane. - - NLISO - Voce isotropic hardening law (or power law) for modeling nonlinear isotropic - hardening using von Mises or Hill plasticity. - - PELAS - Porous elasticity. - - PERF - Perforated material for acoustics; equivalent fluid model of perforated media, - poroelastic material model, and transfer admittance matrix. - - PIEZ - Piezoelectric matrix. - - PLASTIC - Nonlinear plasticity. - - PM - Porous media. Coupled pore-fluid diffusion and structural model of porous media. - - PRONY - Prony series constants for viscoelastic materials. - - PZRS - Piezoresistivity. - - RATE - Rate-dependent plasticity (viscoplasticity) when combined with the ``BISO``, ``NLISO`` or - ``PLASTIC`` material options, or rate-dependent anisotropic plasticity (anisotropic viscoplasticity) - when combined with the HILL and ``BISO``, ``NLISO`` or ``PLASTIC`` material options. - - The exponential visco-hardening option includes an explicit function for directly defining - static yield stresses of materials. - The Anand unified plasticity option requires no combination with other material models. - - SDAMP - Material damping coefficients. - - SHIFT - Shift function for viscoelastic materials. - - SMA - Shape memory alloy for simulating hysteresis superelastic behavior with no performance degradation. - Plane stress is not supported. - - SOIL - Soil models. - - STATE - User-defined state variables. Valid with ``TB,USER`` and used with either the UserMat - or UserMatTh subroutine. Also valid with ``TB,CREEP`` (when ``TBOPT`` = 100) and used with - the UserCreep subroutine. - - SWELL - Swelling strain function. - - TNM - Three-network model for viscoplastic materials. - - THERM - Thermal properties. - - USER - User-defined material model (general-purpose except for incompressible material - models) or thermal material model. - - WEAR - Contact surface wear. - - XTAL - Crystal plasticity for elasto-viscoplastic crystalline materials. - - MATID - Material reference identification number. Valid value is any number ``n``, where 0 < ``n`` < 100,000. Default - = 1. - - NTEMP - The number of temperatures for which data will be provided (if applicable). Specify temperatures - via the :meth:`TBTEMP ` command. - - NPTS - For most labels where ``NPTS`` is defined, the number of data points to be specified for a given - temperature. Define data points via the :meth:`TBDATA ` or :meth:`TBPT ` - commands. - - FuncName - The name of the function to be used (entered as %tabname%, where tabname is the name of - the table created by the Function Tool). Valid only when Lab = ``JOIN`` (joint element material) and - nonlinear stiffness or damping are specified on the ``TBOPT`` field (see "JOIN -- Joint Element Specifications"). - The function must be predefined via the Function Tool. To learn more about how - to create a function, see Using the Function Tool in the Basic Analysis Guide - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - """ - command = "TB,%s,%s,%s,%s,%s,%s,%s" % ( - str(lab), - str(mat), - str(ntemp), - str(npts), - str(tbopt), - str(eosopt), - str(funcname), - ) - return self.run(command, **kwargs) - - def tbcopy(self, lab="", matf="", matt="", **kwargs): - """APDL Command: TBCOPY - - Copies a data table from one material to another. - - Parameters - ---------- - lab - Data table label. See the :meth:`TB ` command for valid labels, and see - "Notes" for Lab = ALL. - - matf - Material reference number where data table is to be copied from. - - matt - Material reference number where data table is to be copied to. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - The TBCOPY command, with Lab = ALL, copies all of the nonlinear data - defined by the :meth:`TB ` command. If you copy a model that includes both yield - behavior constants and linear constants (for example, a BKIN model), - TBCOPY,ALL and MPCOPY are used together to copy the entire model. All - input data associated with the model is copied, that is, all data - defined through the :meth:`TB ` and MP commands. - - Also, if you copy a material model using the Material Model Interface - (Edit> Copy), both the commands TBCOPY,ALL and MPCOPY are issued, - regardless of whether the model includes linear constants only, or if - it includes a combination of linear and yield behavior constants. - - This command is also valid in SOLUTION. - """ - command = "TBCOPY,%s,%s,%s" % (str(lab), str(matf), str(matt)) - return self.run(command, **kwargs) - - def tbdata(self, stloc="", c1="", c2="", c3="", c4="", c5="", c6="", **kwargs): - """APDL Command: TBDATA - - Defines data for the material data table. - - Parameters - ---------- - stloc - Starting location in table for entering data. For example, if - ``STLOC`` = 1, data input in the C1 field applies to the first table - constant, C2 applies to the second table constant, etc. If ``STLOC`` = 5, - data input in the C1 field applies to the fifth table - constant, etc. Defaults to the last location filled + 1. The last - location is reset to 1 with each :meth:`TB ` or - :meth:`TBTEMP ` command. - - c1, c2, c3, . . . , c6 - Data values assigned to six locations starting with ``STLOC``. If a - value is already in this location, it is redefined. A blank value - leaves the existing value unchanged. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - Defines data for the table specified on the last :meth:`TB ` command at the - temperature specified on the last :meth:`TBTEMP ` - command (if applicable). The type of data table specified in the last :meth:`TB ` command determines the - number of data values needed in ``TBDATA``. Data values are linearly - interpolated for temperatures that fall between user defined :meth:`TBTEMP ` - values. See Material Models in the Material Reference for the number of - data values required for different material behavior options. - - This command is also valid in SOLUTION. - """ - command = "TBDATA,%s,%s,%s,%s,%s,%s,%s" % ( - str(stloc), - str(c1), - str(c2), - str(c3), - str(c4), - str(c5), - str(c6), - ) - return self.run(command, **kwargs) - - def tbdele(self, lab="", mat1="", mat2="", inc="", tbopt="", **kwargs): - """APDL Command: TBDELE - - Deletes previously defined material data tables. - - Parameters - ---------- - lab - Data table label. (See the :meth:`TB ` command for valid labels.) If ALL, - delete all data tables. - - mat1, mat2, inc - Delete tables for materials MAT1 to (MAT2 defaults to MAT1) in - steps of INC (defaults to 1). If MAT1= ALL, ignore MAT2 and INC - and delete data tables for all materials. - - tbopt - Material data table option. Visit :meth:`Mapdl.tb ` for valid ``tbopt`` values for a given Lab. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - - If ``lab = "ALL"``, delete all material data tables. - - If ``mat1= "ALL"``, ``mat2`` and ``inc`` are ignored and all material data tables are deleted. - - If ``tbopt`` is specified, the material data table corresponding to ``Lab`` is deleted if it also has the specified table option. If ``tbopt`` is not specified, all material data tables corresponding to ``Lab`` are deleted. ``tbopt`` is ignored when ``Lab = "ALL"``. - - This command is also valid in the solution processor (:meth:`mapdl.slashsolu() `), but is not intended for changing material behaviors between load steps. - """ - command = f"TBDELE,{lab},{mat1},{mat2},{inc},{tbopt}" - return self.run(command, **kwargs) - - def tbeo(self, par="", value="", **kwargs): - """APDL Command: TBEO - - Sets special options or parameters for material data tables. - - Parameters - ---------- - par - Parameter name: - - CAPCREEPREG - Available for the viscoplasticity/creep model (TB,CREEP), allows two creep - models to be specified via the same material ID when - used with the Extended Drucker-Prager model (TB,EDP). - - value - Parameter value: - - SHEA - Use the shear stress-state creep model with the Extended Drucker-Prager model. - Valid only when Par = CAPCREEPREG. - - COMP - Use the compaction stress-state creep model with the Extended Drucker-Prager - model. Valid only when Par = CAPCREEPREG. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - Issue the TBEO command after activating the data table (TB) but before - defining data for the table (TBDATA) or a point on a nonlinear data - curve (TBPT). - """ - command = "TBEO,%s,%s" % (str(par), str(value)) - return self.run(command, **kwargs) - - def tbfield(self, type_="", value="", **kwargs): - """APDL Command: TBFIELD - - Defines values of field variables for material data tables. - - Parameters - ---------- - type_ - Type of field variable: - - FREQ - A frequency is to be specified in Value - - TEMP - A temperature is to be specified in Value - - TIME - A time is to be specified in Value - - NPRES - A normal pressure is to be specified in Value - - SLDA - A total sliding distance (algebraic) is to be specified in Value - - SLDI - A total sliding distance (absolute) is to be specified in Value - - SLRV - A sliding velocity is to be specified in Value - - CYCLE - A healing cycle number is to be specified in Value - - UFXX - User-defined field variable (UF01,UF02, ..., UF09) - - value - The field value to be referenced (use this command multiple times - to enter values of different field variables). - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - Define your data tables as field-variable-dependent (via the - appropriate :meth:`TB ` command shown below), then issue the TBFIELD command to - define the field values. - - Define data values in ascending order for all field quantities. If a - field value is to be held constant, define it only once; subsequent - definitions are ignored. - - There is no limit on the number of values you can specify. The - specified field value remains active until the next TBFIELD command is - input. - - After you have defined the field value(s), define your data for the - data tables (TBDATA). - - See Understanding Field Variables in the Material Reference for more - information about the interpolation scheme used for field-dependent - material properties. - - See Full Harmonic Analysis in the Structural Analysis Guide for more - information about using TBFIELD with TB,ELASTIC or TB,SDAMP. - - The TBFIELD command supports the following material models (TB,Lab - commands): - - The TEMP value specified on this command corresponds to the average - temperature on the contact surface for contact elements CONTA171, - CONTA172, CONTA173, CONTA174, CONTA175, CONTA176, and CONTA177. For - contact element CONTA178, the TEMP value corresponds to the average - temperature of the nodes. - - The TIME value specified on this command corresponds to the analysis - time specified on the TIME command. - - The algebraic sliding distance (SLDA) specified on this command is the - total sliding distance (the algebraic sum) as reported in the element - output definitions table for the contact elements (for example, TASS - and TASR output items for CONTA174). - - The absolute sliding distance (SLDI) specified on this command is the - total accumulated sliding distance (the absolute sum) as reported in - the element output definitions table for the contact elements (for - example, AASS and AASR output items for CONTA174). - - When used with TB,FRIC, field variables defined by TBFIELD are only - available for isotropic friction (TBOPT = ISO) and orthotropic friction - (TBOPT = ORTHO); they are not available for user-defined friction - (TBOPT = USER). - - See Contact Friction in the Material Reference for more information - about using TBFIELD with TB,FRIC. - """ - command = "TBFIELD,%s,%s" % (str(type_), str(value)) - return self.run(command, **kwargs) - - def tbin(self, oper="", par1="", par2="", par3="", par4="", **kwargs): - """APDL Command: TBIN - - Sets parameters used for interpolation of the material data tables. - - Parameters - ---------- - oper - Operation to perform: - - Operation to perform: - SCALE - - par1 - Independent variable, which can be any field variable specified via - the TBFIELD command. - - par2 - Index of any material parameter specified via the TBDATA command. - - par3 - Scale to be used for the independent variable. Valid options are - LINEAR (linear) or LOG (logarithmic). - - par4 - Scale to be used for the dependent variable (the material parameter - specified via Par2). Valid options are LINEAR (linear) or LOG - (logarithmic). - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - For a list of the supported material data tables (TB), see Logarithmic - Interpolation and Scaling in the Material Reference. - """ - command = "TBIN,%s,%s,%s,%s,%s" % ( - str(oper), - str(par1), - str(par2), - str(par3), - str(par4), - ) - return self.run(command, **kwargs) - - def tblist(self, lab="", mat="", **kwargs): - """APDL Command: TBLIST - - Lists the material data tables. - - Parameters - ---------- - lab - Data table label. (See the :meth:`TB ` command for valid labels.) Defaults - to the active table. If ALL, list data for all labels. - - mat - Material number to be listed (defaults to the active material). If - ALL, list data tables for all materials. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - This command is a utility command, valid anywhere. - """ - command = "TBLIST,%s,%s" % (str(lab), str(mat)) - return self.run(command, **kwargs) - - def tbmodif(self, row="", col="", value="", **kwargs): - """APDL Command: TBMODIF - - Modifies data for the material data table (GUI). - - Parameters - ---------- - row, col - The row and column numbers of the table entry to be modified. - - value - The new value to be used in the ROW, COL location. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - The TBMODIF command modifies data for the table specified on the last - :meth:`TB ` command. - - For temperature-dependent data, the temperature specified on the last - TBTEMP command is used. - - TBMODIF is a command generated by the Graphical User Interface (GUI). - It appears in the log file (Jobname.LOG) if a :meth:`TB ` material data table is - graphically edited in spreadsheet fashion. - - The TBMODIF command is not intended to be typed in directly during an - analysis session (although it can be included in an input file for - batch input or for use with the /INPUT command). - - This command is also valid in SOLUTION. - """ - command = "TBMODIF,%s,%s,%s" % (str(row), str(col), str(value)) - return self.run(command, **kwargs) - - def tbplot(self, lab="", mat="", tbopt="", temp="", segn="", **kwargs): - """APDL Command: TBPLOT - - Displays the material data table. - - Parameters - ---------- - lab - Data table label. Valid labels are: MKIN, KINH, MELAS, MISO, - BKIN, BISO, BH, GASKET, and JOIN. Defaults to the active table - label. For B-H data, also valid are: NB to display NU-B2, MH to - display MU vs. H, and SBH, SNB, SMH to display the slopes of the - corresponding data. - - mat - Material number to be displayed (defaults to the active material). - - tbopt - Gasket material or joint element material option to be plotted. - - ALL - Plots all gasket data. - - COMP - Plots gasket compression data only. - - LUNL - Plots gasket linear unloading data with compression curve. - - NUNL - Plots gasket nonlinear unloading data only. - - temp - Specific temperature at which gasket data or joint element material - data will be plotted (used only when Lab = GASKET or JOIN). Use - TEMP = ALL to plot gasket data or joint element material data at - all temperatures. - - segn - Segment number of plotted curve (valid only when Lab = GASKET): - - NO - Segment number is not added to plotted curve (default). - - YES - Segment number is added to plotted curve. This option is ignored if the number - of data points in a curve exceeds 20. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - Only data for stress-strain, B-H, gasket curves, or joint element - nonlinear material model curves can be displayed. - - The TBOPT and TEMP values are valid only when Lab = GASKET or JOIN. - - The SEGN value is valid only when Lab = GASKET. - - This command is valid in any processor. - """ - command = "TBPLOT,%s,%s,%s,%s,%s" % ( - str(lab), - str(mat), - str(tbopt), - str(temp), - str(segn), - ) - return self.run(command, **kwargs) - - def tbpt(self, oper="", x1="", x2="", x3="", xn="", **kwargs): - """APDL Command: TBPT - - Defines a point on a nonlinear data curve. - - Parameters - ---------- - oper - Operation to perform: - - DEFI - Defines a new data point (default). The point is inserted into the table in - ascending order of X1. If a point already exists with the - same X1 value, it is replaced. - - DELE - Deletes an existing point. The X1 value must match the X1 value of the point - to be deleted (XN is ignored). - - x1, x2, ..., xn - The N components of the point. N depends on the type of data table. - Except for TB,EXPE all other :meth:`TB ` Tables support only 2 components. - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - TBPT defines a point on a nonlinear data curve (such as a stress-strain - curve, B-H curve, etc.) at the temperature specified on the last TBTEMP - command. The meaning of the values depends on the type of data table - specified on the last :meth:`TB ` command (MISO, BH, etc.). - - This command is also valid in SOLUTION. - """ - command = "TBPT,%s,%s,%s,%s,%s" % ( - str(oper), - str(x1), - str(x2), - str(x3), - str(xn), - ) - return self.run(command, **kwargs) - - def tbtemp(self, temp="", kmod="", **kwargs): - """APDL Command: TBTEMP - - Defines a temperature for a material data table. - - Parameters - ---------- - temp - Temperature value (defaults to 0.0 if KMOD is blank). - - kmod - If blank, TEMP defines a new temperature. (Issue TBLIST to list - temperatures and data.) - - **kwargs - Extra arguments to be passed to :meth:`Mapdl.run `. - - Notes - ----- - The TBTEMP command defines a temperature to be associated with the data - on subsequent TBPT or TBDATA commands. - - The defined temperature remains active until the next TBTEMP command is - issued. - - Data values must be defined with the temperatures in ascending order. - - This command is also valid in SOLUTION. - """ - command = "TBTEMP,%s,%s" % (str(temp), str(kmod)) - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/materials.py b/src/ansys/mapdl/core/_commands/preproc/materials.py deleted file mode 100644 index 942b44407e4..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/materials.py +++ /dev/null @@ -1,1074 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -""" -These PREP7 commands are used to define the linear material properties. -""" - - -class Materials: - def emunit(self, lab="", value="", **kwargs): - """APDL Command: EMUNIT - - Specifies the system of units for magnetic field problems. - - Parameters - ---------- - lab - Label specifying the type of units: - - MKS - Rationalized MKS system of units (meters, amperes, - henries, webers, etc.). Free-space permeability is - set to 4 πe-7 henries/meter. Free- space - permittivity is set to 8.85 e-12 F/m. - - MUZRO - User defined system of units. Free-space - permeability is set to the value input for - VALUE. Other units must correspond to the - permeability units. Relative permeability may be - altered to absolute values. - - EPZRO - User defined system of units. Free-space - permittivity is set to the value input for - VALUE. Other units must correspond to the - permittivity units. - - value - User value of free-space permeability (defaults to 1) if Lab = - MUZRO, or free-space permittivity (defaults to 1) if Lab = EPZRO. - - Notes - ----- - Specifies the system of units to be used for electric and magnetic - field problems. The free-space permeability and permittivity values may - be set as desired. These values are used with the relative property - values [MP] to establish absolute property values. - - Note:: : If the magnetic source field strength (Hs) has already been - calculated [BIOT], switching EMUNIT will not change the values. - - For micro-electromechanical systems (MEMS), where dimensions are on the - order of microns, see the conversion factors in System of Units in the - Coupled-Field Analysis Guide. - - This command is also valid in SOLUTION. - """ - command = "EMUNIT,%s,%s" % (str(lab), str(value)) - return self.run(command, **kwargs) - - def mp(self, lab="", mat="", c0="", c1="", c2="", c3="", c4="", **kwargs): - """APDL Command: MP - - Defines a linear material property as a constant or a function of - temperature. - - Parameters - ---------- - lab - Valid material property label. Applicable labels are listed under - "Material Properties" in the input table for each element type in - the Element Reference. See Linear Material Properties in the - Material Reference for more complete property label definitions: - - ALPD - Mass matrix multiplier for damping. - - ALPX - Secant coefficients of thermal expansion (also ``ALPY``, ``ALPZ``). - - BETD - Stiffness matrix multiplier for damping. - - .. note:: If used in an explicit dynamic analysis, the value corresponds to the percentage of damping in the high - frequency domain. For example, 0.1 roughly corresponds to 10% damping in the high frequency domain. - - BETX - Coefficient of diffusion expansion (also ``BETY``, ``BETZ``) - - BVIS - Bulk viscosity - - C - Specific heat - - CREF - Reference concentration (may not be temperature dependent) - - CSAT - Saturated concentration - - CTEX - Instantaneous coefficients of thermal expansion (also ``CTEY``, ``CTEZ``) - - CVH - Heat coefficient at constant volume per unit of mass - - DENS - Mass density. - - DMPR - Constant structural damping coefficient in full harmonic analysis or damping ratio in mode-superposition - analysis. - - DXX - Diffusivity coefficients (also ``DYY``, ``DZZ``) - - EMIS - Emissivity. - - ENTH - Enthalpy. - - EX - Elastic moduli (also ``EY``, ``EZ``) - - GXY - Shear moduli (also ``GYZ``, ``GXZ``) - - HF - Convection or film coefficient - - KXX - Thermal conductivities (also ``KYY``, ``KZZ``) - - LSST - Electric loss tangent - - LSSM - Magnetic loss tangent - - MGXX - Magnetic coercive forces (also ``MGYY``, ``MGZZ``) - - MURX - Magnetic relative permeabilities (also ``MURY``, ``MURZ``) - - MU - Coefficient of friction - - NUXY - Minor Poisson's ratios (also ``NUYZ``, ``NUXZ``) (``NUXY`` = νyx, as described in Stress-Strain Relationships in the - Mechanical APDL Theory Reference) - - PERX - Electric relative permittivities (also ``PERY``, ``PERZ``) - - .. note:: If you enter permittivity values less than 1 for ``SOLID5``, ``PLANE13``, or ``SOLID98``, the program interprets - the values as absolute permittivity. Values input for ``PLANE223``, ``SOLID226``, or ``SOLID227`` are always interpreted as - relative permittivity. - - PRXY - Major Poisson's ratios (also ``PRYZ``, ``PRXZ``) (``PRXY`` = νxy, as described in Stress- - Strain Relationships in the Mechanical APDL Theory - Reference) - - QRATE - Heat generation rate for thermal mass element MASS71. Fraction of plastic work - converted to heat (Taylor-Quinney coefficient) for coupled- - field elements ``PLANE223``, ``SOLID226``, and ``SOLID227``. - - REFT - Reference temperature. Must be defined as a constant; ``C1`` through ``C4`` are - ignored. - - RH - Hall Coefficient. - - RSVX - Electrical resistivities (also ``RSVY``, ``RSVZ``). - - SBKX - Seebeck coefficients (also ``SBKY``, ``SBKZ``). - - SONC - Sonic velocity. - - THSX - Thermal strain (also ``THSY``, ``THSZ``). - - VISC - Viscosity. - - mat - Material reference number to be associated with the elements - (defaults to the current MAT setting [MAT]). - - c0 - Material property value, or if a property-versus-temperature - polynomial is being defined, the constant term in the polynomial. - ``C0`` can also be a table name (``%tabname%``); if ``C0`` is a table name, ``C1`` - through ``C4`` are ignored. - - c1, c2, c3, c4 - Coefficients of the linear, quadratic, cubic, and quartic terms, - respectively, in the property-versus-temperature polynomial. Leave - blank (or set to zero) for a constant material property. - - Notes - ----- - MP defines a linear material property as a constant or in terms of a - fourth order polynomial as a function of temperature. (See the TB - command for nonlinear material property input.) Linear material - properties typically require a single substep for solution, whereas - nonlinear material properties require multiple substeps; see Linear - Material Properties in the Material Reference for details. - - If the constants ``C1`` - ``C4`` are input, the polynomial - - .. math:: - - Property = C_0 + C_1(T) + C_2(T)^2 + C_3(T)^3 + C_4(T)^4 - - is evaluated at discrete temperature points with linear interpolation - between points (that is, a piecewise linear representation) and a - constant-valued extrapolation beyond the extreme points. First-order - properties use two discrete points (±9999°). - The :meth:`MPTEMP ` or - :meth:`MPTGEN ` - commands must be used for second and higher order properties to define - appropriate temperature steps. To ensure that the number of - temperatures defined via the :meth:`MPTEMP ` - and :meth:`MPTGEN ` commands is minimally - sufficient for a reasonable representation of the curve, ANSYS - generates an error message if the number is less than ``N``, and a warning - message if the number is less than ``2N``. The value ``N`` represents the - highest coefficient used; for example, if ``C3`` is nonzero and ``C4`` is zero, - a cubic curve is being used which is defined using 4 coefficients so - that ``N`` = 4. - """ - command = "MP,%s,%s,%s,%s,%s,%s,%s" % ( - str(lab), - str(mat), - str(c0), - str(c1), - str(c2), - str(c3), - str(c4), - ) - return self.run(command, **kwargs) - - def mpamod(self, mat="", deftemp="", **kwargs): - """APDL Command: MPAMOD - - Modifies temperature-dependent secant coefficients of thermal - expansion. - - Parameters - ---------- - mat - Material number for which the secant coefficients of thermal - expansion (SCTE's) are to be modified. Defaults to 1. - - deftemp - Definition temperature at which the existing SCTE-versus- - temperature tables were defined. Defaults to zero. - - Notes - ----- - This command converts temperature-dependent SCTE data (properties ALPX, - ALPY, ALPZ) from the definition temperature (DEFTEMP) to the reference - temperature defined by MP,REFT or TREF. If both the MP,REFT and TREF - commands have been issued, the reference temperature defined by the - MP,REFT command will be used. - - This command does not apply to the instantaneous coefficients of - thermal expansion (properties CTEX, CTEY, CTEZ) or to the thermal - strains (properties THSX, THSY, THSZ). - - See Linear Material Properties in the Mechanical APDL Material - Reference and the Mechanical APDL Theory Reference for more details. - - This command is also valid in SOLUTION. - """ - command = "MPAMOD,%s,%s" % (str(mat), str(deftemp)) - return self.run(command, **kwargs) - - def mpchg(self, mat="", elem="", **kwargs): - """APDL Command: MPCHG - - Changes the material number attribute of an element. - - Parameters - ---------- - mat - Assign this material number to the element. Material numbers are - defined with the material property commands [MP]. - - elem - Element for material change. If ALL, change materials for all - selected elements [ESEL]. - - Notes - ----- - Changes the material number of the specified element. Between load - steps in SOLUTION, material properties cannot be changed from linear to - nonlinear, or from one nonlinear option to another. - - If you change from one MKIN model to another MKIN model, the different - MKIN models need to have the same number of data points. This - requirement also applies if you change from one KINH model to another - KINH model, or from one CHABOCHE model to another CHABOCHE model. - """ - command = "MPCHG,%s,%s" % (str(mat), str(elem)) - return self.run(command, **kwargs) - - def mpcopy(self, matf="", matt="", **kwargs): - """APDL Command: MPCOPY - - Copies linear material model data from one material reference number to - another. - - Parameters - ---------- - matf - Material reference number from where material property data will be - copied. - - matt - Material reference number to where material property data will be - copied. - - Notes - ----- - The MPCOPY command copies linear material properties only, which are - all properties defined through the MP command. If you copy a model that - includes both linear and yield behavior constants (for example, a BKIN - model), the MPCOPY and TBCOPY, ALL commands are used together to copy - the entire model. All input data associated with the model is copied, - that is, all data defined through the MP and TB commands. - - Also, if you copy a material model using the Material Model Interface - (Edit> Copy), both the commands MPCOPY and TBCOPY, ALL are issued, - regardless of whether the model includes linear constants only, or if - it includes a combination of linear and yield behavior constants. - - This command is also valid in SOLUTION. - """ - command = "MPCOPY,,%s,%s" % (str(matf), str(matt)) - return self.run(command, **kwargs) - - def mpdata( - self, - lab="", - mat="", - sloc="", - c1="", - c2="", - c3="", - c4="", - c5="", - c6="", - **kwargs, - ): - """APDL Command: MPDATA - - Defines property data to be associated with the temperature table. - - Parameters - ---------- - lab - Valid property label. Applicable labels are listed under "Material - Properties" in the input table for each element type in the Element - Reference. See Linear Material Properties in the Mechanical APDL - Material Reference for more complete property label definitions: - - ALPD - Mass matrix multiplier for damping. - - ALPX - Secant coefficients of thermal expansion (also ALPY, ALPZ). (See also MPAMOD - command for adjustment to reference temperature). - - BETD - Stiffness matrix multiplier for damping. - - BETX - Coefficient of diffusion expansion (also BETY, BETZ) - - C - Specific heat. - - CREF - Reference concentration (may not be temperature dependent) - - CSAT - Saturated concentration - - CTEX - Instantaneous coefficients of thermal expansion (also CTEY, CTEZ). - - DENS - Mass density. - - DMPR - Constant material damping coefficient. - - DXX - Diffusivity coefficients (also DYY, DZZ) - - EMIS - Emissivity. - - ENTH - Enthalpy. - - EX - Elastic moduli (also EY, EZ). - - GXY - Shear moduli (also GYZ, GXZ). - - HF - Convection or film coefficient. - - KXX - Thermal conductivities (also KYY, KZZ). - - LSST - Dielectric loss tangent. - - MGXX - Magnetic coercive forces (also MGYY, MGZZ). - - MU - Coefficient of friction. - - MURX - Magnetic relative permeabilities (also MURY, MURZ). - - NUXY - Minor Poisson's ratios (also NUYZ, NUXZ). - - PERX - Electric relative permittivities (also PERY, PERZ). - - PRXY - Major Poisson's ratios (also PRYZ, PRXZ). - - QRATE - Heat generation rate. - - REFT - Reference temperature (may not be temperature dependent). - - RH - Hall Coefficient. - - RSVX - Electrical resistivities (also RSVY, RSVZ). - - SBKX - Seebeck coefficients (also SBKY, SBKZ). - - SONC - Sonic velocity. - - THSX - Thermal strain (also THSY, THSZ). - - VISC - Viscosity. - - mat - Material reference number to be associated with the elements - (defaults to 1 if you specify zero or no material number). - - sloc - Starting location in table for generating data. For example, if - SLOC = 1, data input in the C1 field is the first constant in the - table. If SLOC = 7, data input in the C1 field is the seventh - constant in the table, etc. Defaults to the last location filled + - 1. - - c1, c2, c3, . . . , c6 - Property data values assigned to six locations starting with SLOC. - If a value is already in this location, it is redefined. A blank - (or zero) value for C1 resets the previous value in SLOC to zero. - A value of zero can only be assigned by C1. Blank (or zero) values - for C2 to C6 leave the corresponding previous values unchanged. - - Notes - ----- - Defines a table of property data to be associated with the temperature - table. Repeat MPDATA command for additional values (100 maximum). - Temperatures must be defined first [MPTEMP]. Also stores assembled - property function table (temperature and data) in virtual space. - - This command is also valid in SOLUTION. - - Without Emag enabled, the ``MURx`` and ``MGxx`` properties are - not allowed. In ANSYS Professional, all structural and - thermal properties are allowed except ALPD, BETD, and MU. In - ANSYS Emag, only the ``RSVx``, ``PERx``, ``MURx``, and ``MGxx`` - properties are allowed. Only products that include ANSYS Emag - can use the LSST property. The ``SBKx`` property is only available - in ANSYS Multiphysics and ANSYS PrepPost. - """ - command = "MPDATA,%s,%s,%s,%s,%s,%s,%s,%s,%s" % ( - str(lab), - str(mat), - str(sloc), - str(c1), - str(c2), - str(c3), - str(c4), - str(c5), - str(c6), - ) - return self.run(command, **kwargs) - - def mpdele(self, lab="", mat1="", mat2="", inc="", lchk="", **kwargs): - """APDL Command: MPDELE - - Deletes linear material properties. - - Parameters - ---------- - lab - Material property label (see MP command for valid labels). If ALL, - delete properties for all applicable labels. - - mat1, mat2, inc - Delete materials from MAT1 to MAT2 (defaults to MAT1) in steps of - INC (defaults to 1). If MAT1 = ALL, MAT2 and INC are ignored and - the properties for all materials are deleted. - - lchk - Specifies the level of element-associativity checking: - - NOCHECK - No element-associativity check occurs. This option is the default. - - WARN - When a section, material, or real constant is associated with an element, ANSYS - issues a message warning that the necessary entity has been - deleted. - - CHECK - The command terminates, and no section, material, or real constant is deleted - if it is associated with an element. - - Notes - ----- - This command is also valid in SOLUTION. - - The LCHK argument is valid only when Lab = ALL. - """ - command = "MPDELE,%s,%s,%s,%s,%s" % ( - str(lab), - str(mat1), - str(mat2), - str(inc), - str(lchk), - ) - return self.run(command, **kwargs) - - def mpdres(self, labf="", matf="", labt="", matt="", **kwargs): - """APDL Command: MPDRES - - Reassembles existing material data with the temperature table. - - Parameters - ---------- - labf - Material property label associated with MATF. - - matf - Material reference number of property to restore from virtual - space. - - labt - Material property label associated with MATT (defaults to label - associated with MATF). - - matt - Material reference number assigned to generated property (defaults - to MATF). - - Notes - ----- - Restores into the database (from virtual space) a data table previously - defined [MP] for a particular property, assembles data with current - database temperature table, and stores back in virtual space as a new - property. - - This command is also valid in SOLUTION. - """ - command = "MPDRES,%s,%s,%s,%s" % ( - str(labf), - str(matf), - str(labt), - str(matt), - ) - return self.run(command, **kwargs) - - def mplib(self, r_w_opt="", path="", **kwargs): - """APDL Command: /MPLIB - - Sets the default material library read and write paths. - - Parameters - ---------- - r-w_opt - Determines what path is being set. Possible values are: - - READ - Set the read path. - - WRITE - Set the write path. - - STAT - Report what read and write paths are currently in use. - - path - The directory path to be used for material library files. - - Notes - ----- - The /MPLIB command sets two path strings used in conjunction with the - material library feature and the MPREAD and MPWRITE commands. - - For MPREAD, when you use the LIB option and no directory path is given - in the file name, the command searches for the file in these locations: - the current working directory, the user's home directory, the user- - specified material library directory (as defined by the - /MPLIB,READ,PATH command), and /ansys_dir/matlib. - - For MPWRITE, when you use the LIB option and the directory portion of - the specification for the material library file is blank, the command - writes the material library file to the directory specified by the - /MPLIB,WRITE,PATH command (if that path has been set). If the path has - not been set, the default is to write the file to the current working - directory. - - The Material Library files supplied with the distribution disks are - meant for demonstration purposes only. These files are not intended - for use in customer applications. - """ - command = "/MPLIB,%s,%s" % (str(r_w_opt), str(path)) - return self.run(command, **kwargs) - - def mplist(self, mat1="", mat2="", inc="", lab="", tevl="", **kwargs): - """APDL Command: MPLIST - - Lists linear material properties. - - Parameters - ---------- - mat1, mat2, inc - List materials from MAT1 to MAT2 (defaults to MAT1) in steps of INC - (defaults to 1). If MAT1= ALL (default), MAT2 and INC are ignored - and properties for all material numbers are listed. - - lab - Material property label (see the MP command for labels). If ALL - (or blank), list properties for all labels. If EVLT, list - properties for all labels evaluated at TEVL. - - tevl - Evaluation temperature for Lab = EVLT listing (defaults to BFUNIF). - - Notes - ----- - For Lab = EVLT, when the property is from tables, the MPPLOT command - will not be valid because the property could be a function of more than - temperature. - - This command is valid in any processor. - """ - command = "MPLIST,%s,%s,%s,%s,%s" % ( - str(mat1), - str(mat2), - str(inc), - str(lab), - str(tevl), - ) - return self.run(command, **kwargs) - - def mpplot(self, lab="", mat="", tmin="", tmax="", pmin="", pmax="", **kwargs): - """APDL Command: MPPLOT - - Plots linear material properties as a function of temperature. - - Parameters - ---------- - lab - Linear material property label (EX, EY, etc.) [MP]. - - mat - Material reference number. Defaults to 1. - - tmin - Minimum abscissa value to be displayed. - - tmax - Maximum abscissa value. - - pmin - Minimum property (ordinate) value to be displayed. - - pmax - Maximum property value. - - Notes - ----- - When the property is from tables, the MPPLOT command will not be valid - because the property could be a function of more than temperature. - - This command is valid in any processor. - """ - command = "MPPLOT,%s,%s,%s,%s,%s,%s" % ( - str(lab), - str(mat), - str(tmin), - str(tmax), - str(pmin), - str(pmax), - ) - return self.run(command, **kwargs) - - def mpread(self, fname="", ext="", lib="", **kwargs): - """APDL Command: MPREAD - - Reads a file containing material properties. - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, - including directory). If you do not specify the ``LIB`` - option, the default directory is the current working - directory. If you specify the ``LIB`` option, the default is - the following search path: the current working directory, - the user's home directory, ``MPLIB_DIR`` (as specified by the - ``/MPLIB,READ,PATH`` command) and ``/ansys_dir/matlib`` (as - defined by installation). If you use the default for your - directory, you can use all 248 characters for the file - name. - - ext - Filename extension (eight-character maximum). - - lib - Reads material library files previously written with the - MPWRITE command. (See the description of the ``LIB`` option - for the ``MPWRITE`` command.) The only allowed value for ``LIB`` - is ``LIB``. - - Notes - ----- - Material properties written to a file without the ``LIB`` option - do not support nonlinear properties. Also, properties written - to a file without the ``LIB`` option are restored in the same - material number as originally defined. To avoid errors, use - ``MPREAD`` with the ``LIB`` option only when reading files written - using MPWRITE with the ``LIB`` option. - - If you omit the ``LIB`` option for ``MPREAD``, this command supports - only linear properties. - - Material numbers are hardcoded. If you write a material file - without specifying the ``LIB`` option, then read that file in - using the ``MPREAD`` command with the ``LIB`` option, the ANSYS - program will not write the file to a new material number. - Instead, it will write the file to the "old" material number - (the number specified on the MPWRITE command that created the - file.) - - This command is also valid in SOLUTION. - """ - return self.run(f"MPREAD,{fname},{ext},,{lib}", **kwargs) - - def mptemp(self, sloc="", t1="", t2="", t3="", t4="", t5="", t6="", **kwargs): - """APDL Command: MPTEMP - - Defines a temperature table for material properties. - - Parameters - ---------- - sloc - Starting location in table for entering temperatures. For example, - if SLOC = 1, data input in the T1 field applies to the first - constant in the table. If SLOC = 7, data input in the T1 field - applies to the seventh constant in the table, etc. Defaults to the - last location filled + 1. - - t1, t2, t3, . . . , t6 - Temperatures assigned to six locations starting with SLOC. If a - value is already in this location, it will be redefined. A blank - (or zero) value for T1 resets the previous value in SLOC to zero. - A value of zero can only be assigned by T1. Blank (or zero) values - for T2 to T6 leave the corresponding previous values unchanged. - - Notes - ----- - Defines a temperature table to be associated with the property data - table [MPDATA]. These temperatures are also used for polynomial - property evaluation, if defined [MP]. Temperatures must be defined in - non-descending order. Issue MATER $ STAT to list the current - temperature table. Repeat MPTEMP command for additional temperatures - (100 maximum). If all arguments are blank, the temperature table is - erased. - - For clear definition, the temperature range you define with the MPTEMP - command should include the entire range you'll use in subsequently - defined materials. To assist the user in this, the first (and only the - first) excursion out of the temperature range defined by the MPTEMP - commands is flagged with a warning message. Similarly, the reference - temperature (TREF or MP,reft commands) should also fall in this same - temperature range. If not and MP,alpx was used, a note will be output. - If not, and MP,ctex or MP,thsx was used, an error message will be - output. - - This command is also valid in SOLUTION. - """ - command = "MPTEMP,%s,%s,%s,%s,%s,%s,%s" % ( - str(sloc), - str(t1), - str(t2), - str(t3), - str(t4), - str(t5), - str(t6), - ) - return self.run(command, **kwargs) - - def mptgen(self, stloc="", num="", tstrt="", tinc="", **kwargs): - """APDL Command: MPTGEN - - Adds temperatures to the temperature table by generation. - - Parameters - ---------- - stloc - Starting location in table for generating temperatures. Defaults - to last location filled + 1. - - num - Number of temperatures to be generated (1-100). - - tstrt - Temperature assigned to STLOC location. - - tinc - Increment previous temperature by TINC and assign to next location - until all NUM locations are filled. - - Notes - ----- - Adds temperatures to the temperature table by generation. May be used - in combination (or in place of) the MPTEMP command. - - This command is also valid in SOLUTION. - """ - command = "MPTGEN,%s,%s,%s,%s" % ( - str(stloc), - str(num), - str(tstrt), - str(tinc), - ) - return self.run(command, **kwargs) - - def mptres(self, lab="", mat="", **kwargs): - """APDL Command: MPTRES - - Restores a temperature table previously defined. - - Parameters - ---------- - lab - Material property label [MP]. - - mat - Material reference number. - - Notes - ----- - Restores into the database (from virtual space) a temperature table - previously defined [MP] for a particular property. The existing - temperature table in the database is erased before this operation. - - This command is also valid in SOLUTION. - """ - command = "MPTRES,%s,%s" % (str(lab), str(mat)) - return self.run(command, **kwargs) - - def mpwrite(self, fname="", ext="", lib="", mat="", **kwargs): - """APDL Command: MPWRITE - - Writes linear material properties in the database to a file - (if the LIB option is not specified) or writes both linear and - nonlinear material properties (if LIB is specified) from the - database to a file. - - Parameters - ---------- - fname - File name and directory path (248 characters maximum, including - directory). If you do not specify the ``LIB`` option, the default - directory is the current working directory. If you specify ``LIB`` and - you have specified a material library directory (via the ``/MPLIB`` - command), that directory is the default. Otherwise, the default is - the current working directory. If you use the default for your - directory, you can use all 248 characters for the file name. - - The file name defaults to Jobname. - - ext - Filename extension (eight-character maximum). - - If you omit the ``LIB`` option, the default extension is - MP. If you specify the ``LIB`` option, the default extension - is units_MPL, where units is the system of units currently - in use. (See the description of the ``/UNITS`` command.) For - example, if ``/UNITS`` is set to BIN, the extension defaults - to BIN_MPL. - - lib - The only value allowed for this field is the string ``"LIB"``. - - The ``LIB`` option indicates that you wish to have properties - associated with the material (``MAT``) written to the - specified material library file using the material library - file format. The material library file format is - ASCII-text-based ANSYS command input. Certain commands - associated with this format have been modified to - interpret the string "_MATL" to mean the currently - selected material. This feature makes the material library - file independent of the material number in effect when the - file was written; this enables you to restore the - properties into the ANSYS database using the material - number of your choice. The ``LIB`` option also enables you to - save both linear and nonlinear properties. If you omit the - ``LIB`` option, you can save linear properties only. - - mat - Specifies the material to be written to the named material library - file. There is no default; you must either specify a material or - omit the ``MAT`` argument. Even if you specify a ``MAT`` value, the ANSYS - program ignores it if the ``LIB`` argument is not specified. - - Notes - ----- - Writes linear material properties currently in the database to a file. - The file is rewound before and after writing. - - This command is also valid in SOLUTION. - """ - return self.run(f"MPWRITE,{fname},{ext},,{lib},{mat}", **kwargs) - - def tbft( - self, - oper="", - id_="", - option1="", - option2="", - option3="", - option4="", - option5="", - option6="", - option7="", - **kwargs, - ): - """APDL Command: TBFT - - Performs material curve-fitting operations. - - Parameters - ---------- - oper - The specific curve-fitting operation: - - Define a constitutive model. - Delete a constitutive model. - - Write data related to a constitutive model to the database (same as TB command). - Initialize coefficients of a constitutive model for nonlinear curve-fitting - procedure. - - Deletes coefficients at current reference temperature. Applicable only for temperature dependent coefficients. - Solve for coefficients. - - Fix (hold constant) the coefficient you specify in Option4. - Add experimental data. - - Delete experimental data. - List all data associated with the material model represented by the material ID - number. - - id_ - The material reference number (same as MAT argument used in the TB - command). Valid entry is any number greater than zero (default = 1) - but less than 100,000. - - option1 - For curve-fit function operations (Oper = FADD, FDEL, FSET, SET, - CDEL, SOLVE or FIX) this field specifies the category (HYPER). - - option2 - For curve-fit function operations (Oper = FADD, FDEL, FSET, SET, - CDEL, SOLVE, or FIX), this field specifies constitutive model type. - The valid entries are listed in Table 231: Hyperelastic Options - below. - - option3 - For Oper = FADD, FDEL, FSET, CDEL, SET, SOLVE or FIX, some of the - cases specified in Option2 will require that the polynomial order - be specified. The applicable values for the order specification are - listed in Table 231: Hyperelastic Options. - - option4 - When you are working on a specific coefficient (Oper = FIX), this - field specifies the index of that coefficient. Valid entries vary - from 1 to n, where n is the total number of coefficients (default = - 1). - - option5 - When you are working on a specific coefficient (Oper = FIX), this - field specifies the index of that coefficient. Valid entries vary - from 1 to N, where N is the total number of coefficients (default = - 1) - - option6 - If Oper = SOLVE, specifies the allowed tolerance in residual change - to stop an iteration. Valid entry is 0.0 to 1.0 (default = 0.0). - - option7 - If Oper = SOLVE, specifies the allowed tolerance in coefficient - change to stop an iteration. Valid entry is 0 to 1 (default = 0). - """ - command = "TBFT,%s,%s,%s,%s,%s,%s,%s,%s,%s" % ( - str(oper), - str(id_), - str(option1), - str(option2), - str(option3), - str(option4), - str(option5), - str(option6), - str(option7), - ) - return self.run(command, **kwargs) - - def uimp( - self, - mat="", - lab1="", - lab2="", - lab3="", - val1="", - val2="", - val3="", - **kwargs, - ): - """APDL Command: UIMP - - Defines constant material properties (GUI). - - Parameters - ---------- - mat - Material number. - - lab1, lab2, lab3 - Material property labels (see the MP command for valid labels). - - val1, val2, val3 - Values corresponding to three labels. - - Notes - ----- - Defines constant material properties. This is a command generated by - the Graphical User Interface (GUI) and will appear in the log file - (Jobname.LOG) if material properties are specified using the Material - Properties dialog box. This command is not intended to be typed in - directly in an ANSYS session (although it can be included in an input - file for batch input or for use with the /INPUT command). - """ - command = "UIMP,%s,%s,%s,%s,%s,%s,%s" % ( - str(mat), - str(lab1), - str(lab2), - str(lab3), - str(val1), - str(val2), - str(val3), - ) - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/_commands/preproc/morphing.py b/src/ansys/mapdl/core/_commands/preproc/morphing.py deleted file mode 100644 index 895174a398b..00000000000 --- a/src/ansys/mapdl/core/_commands/preproc/morphing.py +++ /dev/null @@ -1,325 +0,0 @@ -# Copyright (C) 2016 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -class Morphing: - def morph( - self, - option="", - remeshopt="", - elemset="", - armax="", - voch="", - arch="", - step="", - time="", - stropt="", - **kwargs, - ): - """Specifies morphing and remeshing controls. - - APDL Command: MORPH - - Parameters - ---------- - option - OFF - Turns off morphing for field elements (default). - - ON - Turns on morphing for field elements. - - remeshopt - OFF - Do not remesh (default). - - ON - Remesh when element qualities fall below values - specified by ARMAX, VOCH, or ARCH as explained - below. Valid only when Option is ON. - - elemset - ALL - Remesh all selected elements if the quality of the - worst defined element falls below any quality - requirement (default when Remeshopt = ON). - - CompName - Specify a component name, up to 32 - characters. All elements included in this - component name are remeshed if the quality of - the worst element falls below any quality - requirement. - - armax - The maximum allowable element generalized aspect ratio. Defaults to - 5. - - voch - The maximum allowable change of element size (area or volume). - Defaults to 3. - - arch - The maximum allowable element aspect ratio change. Defaults to 3. - - step - The frequency of element quality checking, based on time steps. A - quality check takes place at the intervals defined by STEP. - Defaults to 1 (quality check at every step). - - time - A quality check takes place at the time point specified. Defaults - to -1 (a quality check at every time point). - - stropt - NO - - NO - There are no structural elements in the model (default). - - YES - There are no structural elements in the model and the morphing happens after - the structural solution. - - Notes - ----- - MORPH is applicable to any non-structural field analysis (not including - fluid elements). It activates displacement degrees of freedom for non- - structural elements so that boundary conditions may be placed on the - field mesh to constrain the movement of the non-structural mesh during - morphing. It morphs the non-structural mesh using displacements - transferred at the surface interface between the structural field and - the non-structural field. The displacements of non-structural elements - are mesh displacements to avoid mesh distortion, but have no physical - meaning except at the interface. MORPH does not support surface, link, - or shell elements, or any element shape other than triangles, quads, - tets, and bricks. Morphed fields must be in the global Cartesian system - (CSYS = 0). - - After each remesh, new databases and results files are written with the - extensions .rth0n and .db0n, where n is the remesh file number - (FieldName.rth01, FieldName.rth02, ... and FieldName.db01, - FieldName.db02, etc.). The original database file is FieldName.dbo. - The FieldName.db01, FieldName.db02, etc. files have elements that are - detached from the solid model. - - Remeshing has the following restrictions: - - Valid only for the electrostatic elements (PLANE121, SOLID122, and - SOLID123) - - Limited to triangle (2-D) and tetrahedral (3-D) options of these - elements - - Valid only for the MFS solver - - No body loads allowed in the interior nodes of the remeshing domain - - Nodes on the boundary cannot be remeshed; remeshing will not work if - morphing failed on the surface nodes - - Not suitable for extreme area or volume changes - - This command is also valid in SOLUTION. - """ - command = f"MORPH,{option},,{remeshopt},{elemset},{armax},{voch},{arch},{step},{time},{stropt}" - return self.run(command, **kwargs) - - def damorph(self, area="", xline="", rmshky="", **kwargs): - """Move nodes in selected areas to conform to structural displacements. - - APDL Command: DAMORPH - - Parameters - ---------- - area - Non-structural area to which mesh movement (morph) applies. If - ALL, apply morphing to all selected areas [ASEL]. If AREA = P, - graphical picking is enabled. A component may be substituted for - AREA. - - xline - Lines to be excluded from morphing. If ALL, exclude all selected - lines [LSEL] from morphing. If XLINE = P, graphical picking is - enabled. A component may be substituted for XLINE. If XLINE is - blank (default), allow morphing of nodes attached to lines of the - selected areas (AREA) which are not shared by unselected areas. - See Notes for clarification. - - rmshky - Remesh flag option: - - 0 - Remesh the selected non-structural areas only if mesh morphing fails. - - 1 - Remesh the selected non-structural areas and bypass mesh morphing. - - 2 - Perform mesh morphing only and do not remesh. - - Notes - ----- - The selected areas should include only non-structural regions adjacent - to structural regions. DAMORPH will morph the non-structural areas to - coincide with the deflections of the structural regions. - - Nodes in the structural regions move in accordance with computed - displacements. Displacements from a structural analysis must be in the - database prior to issuing DAMORPH. - - By default, nodes attached to lines can move along the lines, or off - the lines (if a line is interior to the selected areas). You can use - XLINE to restrain nodes on certain lines. - - By default (RMSHKEY = 0), DAMORPH will remesh the selected non- - structural areas entirely if a satisfactory morphed mesh cannot be - provided. - - If boundary conditions and loads are applied directly to nodes and - elements, the DAMORPH command requires that these be removed before - remeshing can take place. - - Exercise care with initial conditions defined by the IC command. Before - a structural analysis is performed for a sequentially coupled analysis, - the DAMORPH command requires that initial conditions be removed from - all null element type nodes in the non-structural regions. Use ICDELE - to delete the initial conditions. - - Distributed ANSYS Restriction: This command is not supported in - Distributed ANSYS. - """ - command = f"DAMORPH,{area},{xline},{rmshky}" - return self.run(command, **kwargs) - - def demorph(self, elem="", dimn="", rmshky="", **kwargs): - """Move nodes in selected elements to conform to structural displacements. - - APDL Command: DEMORPH - - Parameters - ---------- - elem - Non-structural elements to which mesh movement (morph) applies. - If ALL, apply morphing to all selected elements [ESEL]. If ELEM = - P, graphical picking is enabled. A component may be substituted - for ELEM. - - dimn - Problem dimensionality. Use "2" for a 2-D problem and "3" for a - 3-D problem (no default). - - rmshky - Remesh flag option: - - 0 - Remesh the selected non-structural regions only if mesh morphing fails. - - 1 - Remesh the selected non-structural regions and bypass mesh morphing. - - 2 - Perform mesh morphing only and do not remesh. - - Notes - ----- - The selected elements should include only non-structural regions - adjacent to structural regions. The exterior nodes of the selected - elements will usually be on the boundary of the region which will have - node positions displaced. For DIMN = 2, elements must lie on a flat - plane. The DEMORPH command requires a single domain grouping of - elements be provided (multiple domains of elements are not permitted). - Exterior nodes will be assumed fixed (no nodes will be morphed) unless - they coincide with structural nodes having nonzero displacements. - - Nodes in the structural regions move in accordance with computed - displacements. Displacements from a structural analysis must be in the - database prior to issuing DEMORPH. - - By default (RMSHKY = 0), DEMORPH will remesh the selected non- - structural regions entirely if a satisfactory morphed mesh cannot be - provided. - - If boundary conditions and loads are applied directly to nodes and - elements, the DEMORPH command requires that these be removed before - remeshing can take place. - - Exercise care with initial conditions defined by the IC command. Before - a structural analysis is performed for a sequentially coupled analysis, - the DEMORPH command requires that initial conditions be removed from - all null element type nodes in the non-structural regions. Use ICDELE - to delete the initial conditions. - - Distributed ANSYS Restriction: This command is not supported in - Distributed ANSYS. - """ - command = f"DEMORPH,{elem},{dimn},{rmshky}" - return self.run(command, **kwargs) - - def dvmorph(self, volu="", xarea="", rmshky="", **kwargs): - """Move nodes in selected volumes to conform to structural displacements. - - APDL Command: DVMORPH - - Parameters - ---------- - volu - Non-structural volume to which mesh movement (morph) applies. If - ALL, apply morphing to all selected volumes [VSEL]. If VOLU = P, - graphical picking is enabled. A component may be substituted for - VOLU. - - xarea - Areas to be excluded from morphing. If ALL, exclude all selected - areas [ASEL]. If XAREA = P, graphical picking is enabled. A - component may be substituted for XAREA. If XAREA is blank - (default), allow morphing of nodes attached to areas of the - selected volumes (VOLU) which are not shared by unselected volumes. - (See Notes for clarification). - - rmshky - Remesh flag option: - - 0 - Remesh the selected non-structural volumes only if mesh morphing fails. - - 1 - Remesh the selected non-structural volumes and bypass mesh morphing. - - 2 - Perform mesh morphing only and do not remesh. - - Notes - ----- - The selected volumes should include only non-structural regions - adjacent to structural regions. DVMORPH will morph the non-structural - volumes to coincide with the deflections of the structural regions. - - Nodes in the structural regions move in accordance with computed - displacements. Displacements from a structural analysis must be in the - database prior to issuing DVMORPH. - - By default, nodes attached to areas can move along the areas. You can - use XAREA to restrain nodes on certain areas. - - By default (RMSHKY = 0), DVMORPH will remesh the selected non- - structural volumes entirely if a satisfactory morphed mesh cannot be - provided. - - If boundary conditions and loads are applied directly to nodes and - elements, the DVMORPH command requires that these be removed before - remeshing can take place. - - Exercise care with initial conditions defined by the IC command. Before - a structural analysis is performed for a sequentially coupled analysis, - the DVMORPH command requires that initial conditions be removed from - all null element type nodes in the non-structural regions. Use ICDELE - to delete the initial conditions. - - Distributed ANSYS Restriction: This command is not supported in - Distributed ANSYS. - """ - command = f"DVMORPH,{volu},{xarea},{rmshky}" - return self.run(command, **kwargs) diff --git a/src/ansys/mapdl/core/commands.py b/src/ansys/mapdl/core/commands.py index 7659957ff1a..290d67cd1e5 100644 --- a/src/ansys/mapdl/core/commands.py +++ b/src/ansys/mapdl/core/commands.py @@ -334,25 +334,23 @@ class Prep7Commands( prep7.coupled_dof.CoupledDof, prep7.cross_sections.CrossSections, prep7.data_tables.DataTables, + prep7.database.Database, + prep7.element_type.ElementType, + prep7.elements.Elements, + prep7.explicit_dynamics.ExplicitDynamics, + prep7.hard_points.HardPoints, + prep7.keypoints.Keypoints, + prep7.lines.Lines, + prep7.materials.Materials, prep7.meshing.Meshing, + prep7.morphing.Morphing, ): pass class PreprocessorCommands( - preproc.database.Database, - preproc.explicit_dynamics.ExplicitDynamics, - preproc.lines.Lines, preproc.nodes.Nodes, - preproc.keypoints.KeyPoints, preproc.real_constants.RealConstants, - preproc.digitizing.Digitizing, - preproc.element_type.ElementType, - preproc.elements.Elements, - preproc.hard_points.HardPoints, - preproc.material_data_tables.MaterialDataTables, - preproc.morphing.Morphing, - preproc.materials.Materials, preproc.primitives.Primitives, preproc.sections.Sections, preproc.special_purpose.SpecialPurpose,