!*********************************************************************************************************************************************************!
!* 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. 																															 *!
!*********************************************************************************************************************************************************!
! part #5
!=======================================================================
! coordinates for each node                   Done
!-----------------------------------------------------------------------
! node_no; x2; x3
!-----------------------------------------------------------------------
!Although the arrangement of node no is not necessary to be consecutive, 
!every node starting from 1 to nnode should be present.
!-----------------------------------------------------------------------
allsel,all
*GET,nnode,NODE,0,COUNT
*GET,nelem,ELEM,0,COUNT

*DEL,NODE_MASK
*DEL,NODE_LST
*DEL,NODE_X2
*DEL,NODE_X3
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*DIM,NODE_MASK,ARRAY,nnode
*VGET,NODE_MASK(1),NODE,1,NSEL  !A mask vector for the selected nodes
*DIM,NODE_LST,ARRAY,nnode
*DIM,NODE_X2,ARRAY,nnode
*DIM,NODE_X3,ARRAY,nnode
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*VMASK,NODE_MASK(1)
*VGET,NODE_LST,NODE,,NLIST
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*VMASK,NODE_MASK(1)
*VGET,NODE_X2,NODE,1,LOC,X
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*VMASK,NODE_MASK(1)
*VGET,NODE_X3,NODE,1,LOC,Y


*DEL,COSt_X2
*DEL,SINt_X2
*DEL,COSt_X3
*DEL,SINt_X3
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*DIM,COSt_X2,ARRAY,nnode
*DIM,SINt_X2,ARRAY,nnode
*DIM,COSt_X3,ARRAY,nnode
*DIM,SINt_X3,ARRAY,nnode
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ppi=3.141592653589793238462643383279502884197169399375105820974
*DEL,tttt
*Set,tttt,0
*IF, theta_tlt, NE, 0, THEN
	tttt=theta_tlt*(ppi/180)
*ENDIF

*VFACT,cos(tttt)
*VFUN,COSt_X2,COPY,NODE_X2
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*VFACT,sin(tttt)
*VFUN,SINt_X2,COPY,NODE_X2
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*VFACT,cos(tttt)
*VFUN,COSt_X3,COPY,NODE_X3
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*VFACT,sin(tttt)
*VFUN,SINt_X3,COPY,NODE_X3

*VOPER,NODE_X2,COSt_X2,SUB,SINt_X3
*VOPER,NODE_X3,SINt_X2,ADD,COSt_X3