/
elements.py
2624 lines (2100 loc) · 100 KB
/
elements.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from typing import Optional, Union
from ansys.mapdl.core._commands.parse import parse_e
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_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.