Help regarding a portion of the code used in example in ANSYS APDL



yc = 0.0

xc = 5.0

nsel, s, loc, x,   0  , xc


esel, r, cent, y, -1e-3, 1e-3


cm, cenelem, elem

nelem = 1000

iel = 0

Phi = 0.0

Psi = 0.0

*do, i, 1, nelem, 1

 iel = elnext(iel)

 *if, iel, ne, 0, then

  *do, j, 1, 4, 1

    nd = nelem(iel,j)

    Phi = ny(nd) - yc

    Psi = nx(nd) - xc

    xfdata, ENRICH1, LSM, iel, nd, Phi, Psi



*enddo "


This a code of an XEFM based stationary crack analysis in ANSYS APDL. I couldn't understand this looping section of the code and would mean a lot if someone could explain what is it this portion of the code does. 


  • jpasquerelljpasquerell Canonsburg, PAMember
    edited July 2018

    parameter iel is the element number to be processed for that loop.  It is initialized to 0 before the loop.  This is a method to loop thru a set of numbers that may not be sequential (1,2,3,4) or not be equally spaced (2,4,6,8). It will do up to 1000 loops and if there are less than 1000 elements the elnext get function will return 0 if there are no higher element numbers/

    Apparently xfdata is a macro file (as I do not recognize it as an ANSYS command) so each loop calls xfdata with the current parameter values of ENRICH1, LSM, iel, nd, Phi, and Psi.

  • sk_cheahsk_cheah Member
    edited July 2018

    Looks like Phi and Psi are relative coordinate values (ref for NY and NX). XFDATA is documented here.

    Kind regards,

Sign In or Register to comment.