Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
LS Dyna

LS Dyna

Topics related to LS-DYNA, Autodyn, Explicit STR and more.

EM_CONTROL_MAGNET syntax issues

    • troy.baker
      Subscriber

      I recently noticed something I didn't understand with the EM_CONTROL_MAGNET keyword. On page 385 of the keyword manual (https://lsdyna.ansys.com/wp-content/uploads/2025/04/LS-DYNA_Manual_Vol_III_R16.pdf) it mentions there are two inputs, both mcomp to turn on the keyword, and ncycm to set the number of cycles. So it would be written like this:
      *EM_CONTROL_MAGNET
      $# mcomp ncycm
      1 100
      However, when I use lsprepost to make a keyword file and include the EM_CONTROL_MAGNET keyword, there is no ncycm command, only the mcomp, and it is automatically written as:
      *EM_CONTROL_MAGNET
      $# mcomp
      1

       

      Moreover, with the syntax written by LSPP, the simulation will crash stating "forrtl: severe (164): Program Exception - integer divide by zero" after assembling Fem-Bem matricies, and building P mat, Q mat, and W mat through 100 percent.  This may be a problem with the syntax, or maybe the rebuilding of magnetic vector of a deforming magnet happens too often and there is a threshold somewhere between NCYCM being undefined and 100 that allows the simulation to complete.  If it helps, here is the EM chunk of my .k file

      *EM_PERMANENT_MAGNET
      $#      id       pid     mtype     north     south        hc
               1         1         1         2         1     21033
      *EM_CONTROL
      $#   emsol     numls         -   dimtype    nperio         -   ncylfem   ncylbem
               1       100                   0         0                   1         1
      *EM_CONTROL_MAGNET
      $#   mcomp
               1
      *EM_CONTROL_TIMESTEP
      $#  tstype    dtcons      lcid    factor     tsmin     tsmas     rlcsf    mecats
               3       0.0         0       1.0    1.0E-4      0.25        25         0
      *EM_CONTROL_COUPLING
      $#   thcpl     smcpl    thlcid    smlcid   thcplfl   smcplfl
               1         2         0         0         0         0
      *EM_SOLVER_FEMBEM_MONOLITHIC
      $#   mtype     stype    abstol    reltol     maxit
               0         1    1.0E-6    1.0E-4       100
      *EM_MAT_002
      $#     mid     mtype     sigma     eosid     murel     eosmu    deatht
               1         4       0.0         0       1.1         0    1.0E28
      *EM_EXTERNAL_FIELD
      $# fieldid     ftype      fdef     lcidx     lcidy     lcidz
               1         1         1         4         2         4

    • ErKo
      Ansys Employee

       

      Hi

      Some keywords are not always fully implemented and done in LSPP so that could be the case.

      Please feel free to add the smallest of parts/meshes/ em example here and users/members can perhaps look at it (just say like a cube with max 20 elements or so).

      Also state version used NCPU…etc.

      All the best

      Erko

       

      • troy.baker
        Subscriber

        Ciao,

        I did not realize that all keywords were not fully integrated with lspp, I thought that was only an issue with the workbench environment. 

        My body is 0.06x0.01x0.005 with mesh a uniform cube sizing 0.001x0.001x0.001 (a mm scale body in SI units).  I am running Dyna 2025 R2 V4.13.2 with NCPI set to 1 and using SMP double-precision

        • ErKo
          Ansys Employee

          If you add to LSDYNA Magnets snapping — Welcome to LS-DYNA Examples the below it works fine:

          see the help manual for ncycm (second variable below):

          *EM_CONTROL_MAGENT
          $#   mcomp
                   1         1

          Erko

        • troy.baker
          Subscriber

          $# LS-DYNA Keyword file created by LS-PrePost(R) 2025 R2 (v4.13.2) - 10Jun2025
          $# Created on Apr-3-2026 (12:29:59)
          *KEYWORD 
          *DEFINE_CURVE_TITLE
          Gravity
          $#    lcid      sidr       sfa       sfo      offa      offo    dattyp     lcint
                   1         0       1.0       1.0       0.0       0.0         0         0
          $#                a1                  o1
                           0.0                 0.0
                         0.003                 3.2
                         0.006                 6.5
                         0.009                 9.8
                           3.6                 9.8
          *DEFINE_CURVE_TITLE
          Field
          $#    lcid      sidr       sfa       sfo      offa      offo    dattyp     lcint
                   2         0       1.0       1.0       0.0       0.0         0         0 
          $#                a1                  o1
                           0.0                 0.0
                           0.1               -0.01
                           1.2               -0.03
                           1.7               -0.05
                           3.6               -0.05
          *DEFINE_CURVE_TITLE
          Zero's
          $#    lcid      sidr       sfa       sfo      offa      offo    dattyp     lcint
                   4         0       1.0       1.0       0.0       0.0         0         0
          $#                a1                  o1
                           0.0                 0.0
                           3.6                 0.0
          *LOAD_BODY_Y
          $#    lcid        sf    lciddr        xc        yc        zc       cid
                   1       1.0         0       0.0       0.0       0.0         0
          *CONTROL_IMPLICIT_AUTO
          $#   iauto    iteopt    itewin     dtmin     dtmax     dtexp     kfail    kcycle
                   1        10         5    1.0E-8    1.0E-5       0.0         0         0
          *CONTROL_IMPLICIT_GENERAL
          $#  imflag       dt0    imform      nsbs       igs     cnstn      form    zero_v
                   1    1.0E-5         2         1         2         0         0         0
          *CONTROL_TERMINATION
          $#  endtim    endcyc     dtmin    endeng    endmas     nosol
                 3.5         0       0.0       0.0      20.0         0
          *MAT_ELASTIC
          $#     mid        ro         e        pr        da        db  not used  not used
                   1    1600.0   1318200      0.49       0.0       0.0         0         0
          *EM_PERMANENT_MAGNET
          $#      id       pid     mtype     north     south        hc
                   1         1         1         2         1     21033
          *EM_CONTROL
          $#   emsol     numls         -   dimtype    nperio         -   ncylfem   ncylbem
                   1       100                   0         0                   1         1
          $#-------------------------------
          $# This Part Here
          $#-------------------------------
          *EM_CONTROL_MAGNET
          $#   mcomp
                   1
          $#*EM_CONTROL_MAGNET
          $#   mcomp     ncycm
          $#         1       100 
          $#------------------------------- 
          *EM_CONTROL_TIMESTEP
          $#  tstype    dtcons      lcid    factor     tsmin     tsmas     rlcsf    mecats
                   3       0.0         0       1.0    1.0E-4      0.25        25         0
          *EM_CONTROL_COUPLING
          $#   thcpl     smcpl    thlcid    smlcid   thcplfl   smcplfl
                   1         2         0         0         0         0
          *EM_SOLVER_FEMBEM_MONOLITHIC
          $#   mtype     stype    abstol    reltol     maxit
                   0         1    1.0E-6    1.0E-4       100
          *EM_MAT_002
          $#     mid     mtype     sigma     eosid     murel     eosmu    deatht
                   1         4       0.0         0       1.1         0    1.0E28
          *EM_EXTERNAL_FIELD
          $# fieldid     ftype      fdef     lcidx     lcidy     lcidz
                   1         1         1         4         2         4  
          *EM_OUTPUT
          $     matS      matF      solS      solF      mesh
                   2         2         2         2         0 
          *EM_DATABASE_PARTDATA
          $    outlv     dtout
                   1      1.16  
          *NODE
          $#   nid               x               y               z      tc      rc
                 1             0.0             0.0             0.0       0       0
                 2           0.012             0.0             0.0       0       0
                 3           0.024             0.0             0.0       0       0
                 4           0.036             0.0             0.0       0       0
                 5           0.048             0.0             0.0       0       0
                 6            0.06             0.0             0.0       0       0
                 7             0.0          0.0025             0.0       0       0
                 8           0.012          0.0025             0.0       0       0
                 9           0.024          0.0025             0.0       0       0
                10           0.036          0.0025             0.0       0       0
                11           0.048          0.0025             0.0       0       0
                12            0.06          0.0025             0.0       0       0
                13             0.0           0.005             0.0       0       0
                14           0.012           0.005             0.0       0       0
                15           0.024           0.005             0.0       0       0
                16           0.036           0.005             0.0       0       0
                17           0.048           0.005             0.0       0       0
                18            0.06           0.005             0.0       0       0
                19             0.0             0.0           0.005       0       0
                20           0.012             0.0           0.005       0       0
                21           0.024             0.0           0.005       0       0
                22           0.036             0.0           0.005       0       0
                23           0.048             0.0           0.005       0       0
                24            0.06             0.0           0.005       0       0
                25             0.0          0.0025           0.005       0       0
                26           0.012          0.0025           0.005       0       0
                27           0.024          0.0025           0.005       0       0
                28           0.036          0.0025           0.005       0       0
                29           0.048          0.0025           0.005       0       0
                30            0.06          0.0025           0.005       0       0
                31             0.0           0.005           0.005       0       0
                32           0.012           0.005           0.005       0       0
                33           0.024           0.005           0.005       0       0
                34           0.036           0.005           0.005       0       0
                35           0.048           0.005           0.005       0       0
                36            0.06           0.005           0.005       0       0
                37             0.0             0.0            0.01       0       0
                38           0.012             0.0            0.01       0       0
                39           0.024             0.0            0.01       0       0
                40           0.036             0.0            0.01       0       0
                41           0.048             0.0            0.01       0       0
                42            0.06             0.0            0.01       0       0
                43             0.0          0.0025            0.01       0       0
                44           0.012          0.0025            0.01       0       0
                45           0.024          0.0025            0.01       0       0
                46           0.036          0.0025            0.01       0       0
                47           0.048          0.0025            0.01       0       0
                48            0.06          0.0025            0.01       0       0
                49             0.0           0.005            0.01       0       0
                50           0.012           0.005            0.01       0       0
                51           0.024           0.005            0.01       0       0
                52           0.036           0.005            0.01       0       0
                53           0.048           0.005            0.01       0       0
                54            0.06           0.005            0.01       0       0
          *PART
          $#                                                                         title
          beam
          $#     pid     secid       mid     eosid      hgid      grav    adpopt      tmid
                   1         1         1         0         0         0         0         0
          *SECTION_SOLID
          $#   secid    elform       aet         -         -         -    cohoff   gaskett
                   1         1         0                                     0.0       0.0
          *ELEMENT_SOLID
          $#   eid     pid      n1      n2      n3      n4      n5      n6      n7      n8
                 1       1       1       2       8       7      19      20      26      25
                 2       1       2       3       9       8      20      21      27      26
                 3       1       3       4      10       9      21      22      28      27
                 4       1       4       5      11      10      22      23      29      28
                 5       1       5       6      12      11      23      24      30      29
                 6       1       7       8      14      13      25      26      32      31
                 7       1       8       9      15      14      26      27      33      32
                 8       1       9      10      16      15      27      28      34      33
                 9       1      10      11      17      16      28      29      35      34
                10       1      11      12      18      17      29      30      36      35
                11       1      19      20      26      25      37      38      44      43
                12       1      20      21      27      26      38      39      45      44
                13       1      21      22      28      27      39      40      46      45
                14       1      22      23      29      28      40      41      47      46
                15       1      23      24      30      29      41      42      48      47
                16       1      25      26      32      31      43      44      50      49
                17       1      26      27      33      32      44      45      51      50
                18       1      27      28      34      33      45      46      52      51
                19       1      28      29      35      34      46      47      53      52
                20       1      29      30      36      35      47      48      54      53
          *SET_NODE_LIST_TITLE
          NODESET(SPC) 1
          $#     sid       da1       da2       da3       da4    solver       its         -
                   1       0.0       0.0       0.0       0.0                   1          
          $#    nid1      nid2      nid3      nid4      nid5      nid6      nid7      nid8
                   1         7        13        19        25        31        37        43
                  49         0         0         0         0         0         0         0
          *SET_SEGMENT_TITLE
          South
          $#     sid       da1       da2       da3       da4    solver       its         -
                   1       0.0       0.0       0.0       0.0MECH               0          
          $#      n1        n2        n3        n4        a1        a2        a3        a4
                   7         1        19        25       0.0       0.0       0.0       0.0
                  13         7        25        31       0.0       0.0       0.0       0.0
                  25        19        37        43       0.0       0.0       0.0       0.0
                  31        25        43        49       0.0       0.0       0.0       0.0
          *SET_SEGMENT_TITLE
          North
          $#     sid       da1       da2       da3       da4    solver       its         -
                   2       0.0       0.0       0.0       0.0MECH               0          
          $#      n1        n2        n3        n4        a1        a2        a3        a4
                   6        12        30        24       0.0       0.0       0.0       0.0
                  12        18        36        30       0.0       0.0       0.0       0.0
                  24        30        48        42       0.0       0.0       0.0       0.0
                  30        36        54        48       0.0       0.0       0.0       0.0
          *BOUNDARY_SPC_SET
          $#    nsid       cid      dofx      dofy      dofz     dofrx     dofry     dofrz
                   1         0         1         1         1         1         1         1
          *END

        • ErKo
          Ansys Employee

           

           

           

           

          The above example runs fine with:

          *EM_CONTROL_MAGENT
          $#   mcomp
                   1         1

          But this keyword is never used I saw so you do not need (magnetization or scalar potential follows the elements so does not need to really be recomputed even if part bends)

          Used official LS-Dyna rel 16.1.1-20 (you stated the LSPP rel. that is not important, it is the solver below that is):

               |  Version : mpp d R16                              |
               |  Revision: R16.1.1-20-g0c90cad538  

          (I would not suggest using any other rel. for em analysis – only official rel R16 as the one stated above)
          All the best

          Erko

           

           

           

           

        • troy.baker
          Subscriber

          My institution has licenses for Ansys 2025r2, and probably wont update that until 2026r2.  Currently only 2026r1 is released as far as I know.  Is there that much of a gap between the EM keywords between the release 16.1.1 and the release that would come installed with a full 2025 r2 license?
          Solver output files state:

               |  LS-DYNA, A Program for Nonlinear Dynamic         |
               |  Analysis of Structures in Three Dimensions       |
               |  Date    : 05/14/2025    Time: 11:18:04           |
               |  Version : smp d R14                              |
               |  Revision: R14.1.1-16-gfadfb49b17    

          So i believe that is release 14.1, which would be the 2023 version.  I previously used the 2023 R2 license and updated it a few months ago, maybe it only updated files related to workbench and not Dyna.  Although the LSrun files are stored in Program Files/ANSYSInc/v252 where the rest of the Ansys 2025 version files should be kept instead of v232, where the 2023 version files should be.  Is there a specific way to run an update for LS dyna under the license key i have without having to uninstall, clear all files, and reinstall the rest of my Ansys programs?


          I ask becasue once using the two argument based EM_CONTROL_MAGNET keyword, I run into error with 
          *EM_OUTPUT_FORCES
          $#    iout     outdt     lcoff        sf
                   1       0.0         0       1.0

          where it says the line relating to arguments is incorrect:

           *** Error 10246 (KEY+246)
               line contains improperly formatted data
                 reading *EM_OUTPUT
                    At line# 78 of file
           C:\Users\user\filepath\Testing.k
           --------------------------------------------------------------------------
                    1       0.0         0       1.0
           --------------------------------------------------------------------------
          It references EM_OUTPUT but then the commands under the line for EM_OUTPUT_FORCES, so maybe the older release doesn't recognize the output_forces keyword

    • ErKo
      Ansys Employee

       

       

      Do not use WB LS-Dyna (not supported only resistive heat solver is) for this and do not use R14.

      For EM always use official LS-Dyna rel 16.1.1-20 (you stated the LSPP rel. that is not important, it is the solver below that is):

           |  Version : mpp d R16                              |
           |  Revision: R16.1.1-20-g0c90cad538  

      (I would not suggest using any other rel. for em analysis – only official rel R16 as the one stated above)

      You can talk to your Uni and they can download and install R16.

      LSDYNA Download / Install Overview
      See here for credentials
      LS-Dyna License Manger – Network License Registration

      All the best – that is it for me – happy easter 
      and good luck

      Erko

       

       

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]