Search code examples
ansys

extract the maximum value available in the defined table in APDL?


Hello Ansys APDL users, I want to extract the maximum value available in the defined table, how do I do that? Suppose I have this code:

ESEL,ALL             
ETAB,EVOL,VOLU 
SET,50,LAST 
ETAB,EPS50,NL,EPEQ 
SET,32,LAST 
ETAB,EPS32,NL,EPEQ 
SADD,EPS2,EPS50,EPS32,1,-1 
SMULT,EPS_v,EPS2,EVOL,1,1   

Now, I want to get the maximum value in table EPS_v or EPS2, how to get that? When using Ansys in GUI mode, I can simply use the following command to extract the value:

PLETAB,EPS_v,AVG
*GET,EPS_max,PLNSOL,,MAX

But if I am running the simulation in batch mode, I can’t use these commands. Is there any other way I can extract the maximum value from the defined table? Or is there any other way we can save the full table as a text file? Your responses are highly appreciated. Thank you in advance!


Solution

  • You can sort an element table with

    ESORT, Item, Lab, ORDER, KABS, NUMB
    

    than take the max item.

    In your case that would be:

    etable,EPS50,NL,EPEQ
    esort,etab,EPS50,1
    *get,EPS_max,sort,0,max
    

    Or you could export the etables to a txt file:

    *GET,ecount,ELEM,,COUNT
    *DIM,EARRAY,,ecount,2    
    *VGET,EARRAY(1,1),ELEM,,ETAB,EPS2    
    *VGET,EARRAY(1,2),ELEM,,ETAB,EPS_v    
    *CFOPEN,ETABLES,txt    
    *VWRITE,SEQU,EARRAY(1,1),EARRAY(1,2)
    (F10.0,5X,F10.8,5X,F10.8)
    *CFCLOSE