*CREATE,VABS_APDL_VisualRecovery/RecoverInput,mac
!*********************************************************************************************************************************************************!
!* Copyright (c) <2015> <Purdue University> All rights reserved.																					     *!
!*                                                                      																			     *!
!* Developed by:  Fang Jiang, Wenbin Yu                                                                                                                  *!
!*        <Prof. Yu’s Research Group>,                                                                                                                   *!
!*        <School of Aeronautics and Astronautics, Purdue University>                                                                                    *!
!*        <https://cdmhub.org/projects/ansysvabsgui2015>                                                                                                 *!
!*                                                                      																			     *!
!* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),    *!
!* to deal with 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:            *!
!*                                                                      																			     *!
!* •Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.                        *!
!*                                                                      																			     *!
!* •Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation *!
!*  and/or other materials provided with the distribution.                                                                                               *!
!*                                                                      																			     *!
!* •Neither the names of < Prof. Yu’s Research Group, School of Aeronautics and Astronautics, Purdue University >,                                       *!
!*  nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.   *!
!*                                                                      																			     *!
!* 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 CONTRIBUTORS 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 WITH THE SOFTWARE. 																															 *!
!*********************************************************************************************************************************************************!
!-------------------------------------------------------------------------
/NOPR
!/UIS,MSGPOPUP,1
/PREP7

!RESUME,1111_sta74_mtr_lyr_mod_te_le_lyt_glue_lmn_msh,db,
ALLSEL,ALL
EPLOT

*GET,ECOUNT,ELEMENT,,COUNT
!ECOUNT = 2080

*DEL,ESTRLOC
*DIM,ESTRLOC,,25,ECOUNT

*SET,RecoverFileEXT,'dat.ELE'
*ASK,RecoverFile,': 'name of file with elementally averaged results''
*VREAD,ESTRLOC(1,1),UserRecovery/%RecoverFile%,%RecoverFileEXT%,,IJK,25,ECOUNT,
((4x,i7,24(e20.10)))
!*VREAD,ESTRLOC(1,1),STA_74.dat,ELE,,IJK,25,ECOUNT,
!((4x,i7,24(e20.10)))

*MSG,UI
Reading in recovered stress and strain field...%/&
Data transfer needs time.%/&
-----------------------------------------------%/&
Notation convention:%/&
ANSYS:  X,  Y,  Z, XY, YZ, XZ%/&
VABS:  22, 33, 11, 23, 13, 12

!VABS  .ELE file
!      elem#   strain              stress
!      c1,     c2,c3,c4,c5,c6,c7,  c8, c9,c10,c11,c12,c13
!---:          11,12,13,22,23,33,  11, 12, 13, 22, 23, 33
!---:           Z,XZ,YZ, X,XY, Y,   Z, XZ, YZ,  X, XY,  Y

/prep7
*abset,'Transfering Data into PostProcs',BAR
/POST1
*DO,I,1,ECOUNT 
	jjjj=I*100/Ecount
	*abcheck,jjjj
	*IF,jjjj,gt,99,then
		*ABFINI
	*ENDIF
! PROCESS BAR RETURNING FUNCTION
!---stresses
DESOL,I,ALL,EPEL,X,ESTRLOC(5,I),ESTRLOC(7,I),ESTRLOC(2,I),ESTRLOC(6,I),ESTRLOC(4,I),ESTRLOC(3,I)
!DESOL,I,ALL,EPEL,X,          X,           Y,           Z,          XY,          YZ,         XZ
!---strains
DESOL,I,ALL,S,X,ESTRLOC(11,I),ESTRLOC(13,I),ESTRLOC(8,I),ESTRLOC(12,I),ESTRLOC(10,I),ESTRLOC(9,I)
*ENDDO

RSYS,SOLU   ! activate the elemental local coordinate which is actually the beam coordinate from VABS
!/POST1
!/EFACET,1

*END