/out,coreloss,out
/com, computes the coreloss (W) for the active elements for 2D or 3D models.
/com, the coreloss data for the laminate must be defined in the table  COREMAT.
/com, the total heat load is stored in the parameter CORELOS.
!
! example for COREMAT
!
*if,_use,eq,1,then

     *set,coremat
     *dim,coremat,table,10
     coremat(1,0)= .2,  .4,   .6,  .8,    1.0,   1.2,   1.4,  1.8,  2.4,  4   !  B(T)
     coremat(1,1)= .14,.45,  .94,  1.6,  2.5,    3.5,   4.6,   9,   18,  85   !  Watts/Lb

*endif
!
!
*get,_cort,parm,coremat,type

*if,_cort,ne,2,:end

 *if,dencor,le,0,then
  dencor=.283*39.37**3    !   converts density (lb/in^3) to lb/m^3) for coreloss
                          !   data, which is in Coreloss(Watts/lb) versus B(Gauss)
 *endif
 _dencor=dencor



 _bc_fac=1
 *get,_dimn,active,,solu,dimn        ! 1=axisym, 2=planar, 3=3d 
 *if,stkthk,le,0,then
   _stk=ggeom
 *else
   _stk=ggeom*stkthk
 *endif
 *if,_dimn,eq,3,then
   _stk=1
 *endif
 *get,_ecntm,elem,,count

 cm,_core,elem
 alls
 *get,_elmx,elem,,num,max
 *set,_bsum
 *dim,_bsum,,_elmx
 *set,_core
 *dim,_core,,_elmx
 *set,_mskv
 *dim,_mskv,,_elmx
 cmsel,,_core
 *vget,_mskv(1),elem,,esel
 *voper,_mskv(1),_mskv(1),ge,0
 etab,,b,sum
 etab,,volu
 *if,arg1,ne,0,then
  sadd,bsum,bsum,,1/sqrt(2)
 *endif
 sadd,cored,volu,volu,1,-1
 *vmask,_mskv(1)
 *vget,_bsum(1),elem,1,etab,bsum

 *vmask,_mskv(1)       !  1/4/00
 *voper,_bsum(1),_bsum(1),mult,_bc_fac      !  1/4/00

 *vmask,_mskv(1)
 *vitrp,_core(1),coremat(1,1),_bsum(1)
 *vmask,_mskv(1)
 *vput,_core(1),elem,1,etab,cored
 cmsel,,_core
 etab,,volu
 sadd,cored,cored,,_dencor
 smult,core,cored,volu
 ssum
 *get,corelos,ssum,,item,core
 corelos=corelos*_stk


/out,coreloss,sum
*msg,info
__________CORE LOSS CALCULATION SUMMARY _________________
*msg,info

*msg,info,_ecntm
Number of elements:________________ %i
*msg,info,stkthk
Stack thickness:___________________ %g
*msg,info,nint(corelos*10)/10
Coreloss (CORELOS) (W):____________ %g
/out
*if,_mg1,eq,0,then
 *uili,coreloss,sum
*endif


:end
/out