*#loop Intervals
*Set Var selectionXprazdna=1
*Set Var selectionYprazdna=1
*Set Var selectionZprazdna=1
*Set Cond Boundary_Reactions_for_Line *nodes
*If(CondNumEntities(Int)>0)
// --- Boundary_reactions_for_line
*# // Fix nodes of interphase between MAIN_DOMAIN and EXCAVATED_DOMAIN 
*# // This step is needed, if MAIN_DOMAIN and EXCAVATED_DOMAIN does not use Master-Slave interphase,
*# // i.e. use the same nodes. After this step I get out-off-balanced forces at the interface
// selection has *CondNumEntities entities
*#If(Cond(Apply_in_Subincrement,int)==ApplyInSubincrement)
*loop nodes *OnlyInCond
*# *Cond(DOF_1,int) *Cond(DOF_2,int) *Cond(DOF_3,int)
*If(Cond(DOF_1,int)==1)
*Format "%i"
SELECTION "Boundary_INT_*IntervalIndex_X" LIST *NodesNum
*Set Var selectionXprazdna=0
*EndIf
*If(Cond(DOF_2,int)==1)
*Format "%i"
SELECTION "Boundary_INT_*IntervalIndex_Y" LIST *NodesNum
*Set Var selectionYprazdna=0
*EndIf
*If(Cond(DOF_3,int)==1)
*Format "%i"
SELECTION "Boundary_INT_*IntervalIndex_Z" LIST *NodesNum
*Set Var selectionZprazdna=0
*EndIf
*End Nodes
 ;
*#EndIf


*If(selectionXprazdna==0)
*Format "%i"
SELECTION "Boundary_INT_*IntervalIndex_X" REMOVE_DUPLICATES ;
*Format "%i"
// ALLOCATE_DOFS NODES AT SELECTION "Boundary_INT_*IntervalIndex_X" DOFS_MASK 3 // allocate dofs to interface nodes from EXCAVATED_DOMAIN; otherwise no load is applied
*EndIf

*If(selectionYprazdna==0)
*Format "%i"
SELECTION "Boundary_INT_*IntervalIndex_Y" REMOVE_DUPLICATES ;
*Format "%i"
// ALLOCATE_DOFS NODES AT SELECTION "Boundary_INT_*IntervalIndex_Y" DOFS_MASK 3 // allocate dofs to interface nodes from EXCAVATED_DOMAIN; otherwise no load is applied
*EndIf

*If(selectionZprazdna==0)
*Format "%i"
SELECTION "Boundary_INT_*IntervalIndex_Z" REMOVE_DUPLICATES ;
*Format "%i"
//ALLOCATE_DOFS NODES AT SELECTION "Boundary_INT_*IntervalIndex_Z" DOFS_MASK 3 // allocate dofs to interface nodes from EXCAVATED_DOMAIN; otherwise no load is applied
*EndIf

*Format "%i"
//OUTPUT LOCATION NODES NODE AT SELECTION "Boundary_INT_*IntervalIndex_X" DATA LIST "PARTIAL_INTERNAL_FORCES"  END ;

LOAD CASE ID *Operation(IntervalIndex+10000) NAME "Fix interphase nodes"
*If(selectionXprazdna==0)
*Format "%i"
SUPPORT SIMPLE SELECTION "Boundary_INT_*IntervalIndex_X" dof 1 const 0.
*EndIf
*If(selectionYprazdna==0)
*Format "%i"
SUPPORT SIMPLE SELECTION "Boundary_INT_*IntervalIndex_Y" dof 2 const 0.
*EndIf
*If(selectionZprazdna==0)
*Format "%i"
SUPPORT SIMPLE SELECTION "Boundary_INT_*IntervalIndex_Z" dof 3 const 0.
*EndIf
 

LOAD CASE ID *Operation(IntervalIndex+20000) NAME "Unbalanced internal forces from EXCAVATED_DOMAIN"
*If(selectionXprazdna==0)
*Format "%i"
LOAD SIMPLE SELECTION "Boundary_INT_*IntervalIndex_X" dof -1 const 0.   SAVE_LOAD 
*EndIf
*If(selectionYprazdna==0)
*Format "%i"
LOAD SIMPLE SELECTION "Boundary_INT_*IntervalIndex_Y" dof -2 const 0.   SAVE_LOAD 
*EndIf
*If(selectionZprazdna==0)
*Format "%i"
LOAD SIMPLE SELECTION "Boundary_INT_*IntervalIndex_Z" dof -3 const 0.   SAVE_LOAD 
*EndIf

// --- Boundary_reactions_for_line END 
*EndIf
*#End Intervals