Difference between revisions of "User macro to flip the boundary codes"

From FEAP Wiki
Jump to navigation Jump to search
Line 77: Line 77:
stop
stop
</pre>
</pre>
After the computation one can plot the time histories that have been saved to see that when the reaction force dropped below 0.01, the boundary conditions where flipped.
[[File:unlm.jpg]]

Revision as of 14:45, 24 June 2025

Consider the problem of mimicking the behavior of a standard load/unload experiment that is displacement controlled up to the point where the load cell reads zero force and the machine then switches to load control. In a FEAP computation the boundary codes on the driven nodes can be dynamically changed by changing the values in the ID(ndf,numnp,1:2) array. In particular if for a given dof and node number the value of ID( , , 2) is set to zero then FEAP will treat the dof as active and look for forced values as set by the FORCe command in the input file. If these have been omitted, then the force will be taken as zero.

Here is an example of a MACRo command that will achieve this purpose. It allows one to identify the nodes to be switched using a simple search on a given plane. Then it allows one to switch the boundary codes once the reactions on the selected nodes drop below a specified tolerance for times greater than some given value.

Here is an input file that will use the MACRo called ULNM

feap ** UNLM user macro test, viscoelastic bar unloading **
ndf = 2
ndm = 2
nen = 4

mate 1    ! Viscoelastic material
 solid
  elastic isotropic 10 0.3
  viscoelastic deviatoric 0.5 1.0

block     ! Strip geometry
 cart 5 10
 1 0.0  0.0
 2 5.0  0.0
 3 5.0 10.0
 4 0.0 10.0

eboun     ! Clamped top and bottom
 2  0 1 1
 2 10 1 1

edisp     ! Driven displacement at the top, No defined forces, they will default to zero
 2 10 0 1.0

end

batch     ! prop curve for the displacements
 prop,,1
end
2 1
0.0 0.0
1.0 1.0
2.0 0.0


batch     ! Get time history of the diplacement at the top-left node, and top surface reactions
 tplot
end
disp,,2,0.0,10.0
rsum,2,61,66
show


batch
 plot,defo,1
 dt,,.01
 loop,,100  ! Extend to displacement of 1.0
  time
  loop,,10
   tang,,1
  next
  plot,wipe
  plot,mesh
  plot,boun
 next
 unlm,edir,2,10.0  ! Set-up nodes to be released
 loop,,500
  time
  loop,,10
   tang,,1
  next
  plot,wipe
  plot,mesh
  plot,boun
  reac ! compute reactions 
  unlm,forc,0.01,1.5  ! Check if cross-head reaction force is below 0.01 and that time is above 1.5, then only flip
 next
end


stop

After the computation one can plot the time histories that have been saved to see that when the reaction force dropped below 0.01, the boundary conditions where flipped. File:Unlm.jpg