For those starting out, here's a few commands I find pretty neat. If you're not familiar with them, it's worth checking out.
NDNEXT & ELNEXT
When looping through a bunch of nodes or elements, this provide some convenience.
/post1
cmsel, s, NodesOfInterest
*get, ncount, node, 0, count
*dim, uxsave,, ncount, 2
nnow = 0
*do,ct,1,ncount
nnow = ndnext(nnow)
uxsave(ct, 1) = nnow
*get, uxsave(ct, 2), node, nnow, u, x
*enddo
*stat, uxsave
Alternately, one could instead use fancier commands: *VGET with *VMASK
cmsel, s, NodesOfInterest
*get, nmx, node,, num, max
*get, ncount, node,, count
*dim, ndata,, nmx, 3
*dim, nkeep,, ncount, 2
*vget, ndata(1,1), node, 1, nsel
*vfill,ndata(1,2),ramp,1,1
*vmask, ndata(1,1)
*vget, ndata(1,3), node, 1, u, x
*vmask, ndata(1,1)
*vfun, nkeep(1,1), comp, ndata(1,2)
*vmask, ndata(1,1)
*vfun, nkeep(1,2), comp, ndata(1,3)
*stat, nkeep
q=UX(N)
This is equivalent to the above *get, q, node, N, u, x
Other succinct functions can be found here.
/PLOPTS, DATE, 0
This turns off the time and date display. It makes the screen more neat.
*VWRITE
When needing to export data for nicer plots in another software, it took me a while to figure out I can't run the following in the GUI. It has to be in a separate ASCII file called via \INPUT or as a macro. There should also not be any spaces in front of the *vwrite and formatting commands.
*cfopen, rboltf1.txt
*vwrite, rbolt1(1,1), rbolt1(1,2), rbolt1(1,3)
(E,' ',E,' ',E)
*cfclos
%aVar%
The percentage symbol enclosing a variable will create a forced substitution. This is advantageous in loops, file names etc.
NDNEXT & ELNEXT
When looping through a bunch of nodes or elements, this provide some convenience.
/post1
cmsel, s, NodesOfInterest
*get, ncount, node, 0, count
*dim, uxsave,, ncount, 2
nnow = 0
*do,ct,1,ncount
nnow = ndnext(nnow)
uxsave(ct, 1) = nnow
*get, uxsave(ct, 2), node, nnow, u, x
*enddo
*stat, uxsave
Alternately, one could instead use fancier commands: *VGET with *VMASK
cmsel, s, NodesOfInterest
*get, nmx, node,, num, max
*get, ncount, node,, count
*dim, ndata,, nmx, 3
*dim, nkeep,, ncount, 2
*vget, ndata(1,1), node, 1, nsel
*vfill,ndata(1,2),ramp,1,1
*vmask, ndata(1,1)
*vget, ndata(1,3), node, 1, u, x
*vmask, ndata(1,1)
*vfun, nkeep(1,1), comp, ndata(1,2)
*vmask, ndata(1,1)
*vfun, nkeep(1,2), comp, ndata(1,3)
*stat, nkeep
q=UX(N)
This is equivalent to the above *get, q, node, N, u, x
Other succinct functions can be found here.
/PLOPTS, DATE, 0
This turns off the time and date display. It makes the screen more neat.
*VWRITE
When needing to export data for nicer plots in another software, it took me a while to figure out I can't run the following in the GUI. It has to be in a separate ASCII file called via \INPUT or as a macro. There should also not be any spaces in front of the *vwrite and formatting commands.
*cfopen, rboltf1.txt
*vwrite, rbolt1(1,1), rbolt1(1,2), rbolt1(1,3)
(E,' ',E,' ',E)
*cfclos
%aVar%
The percentage symbol enclosing a variable will create a forced substitution. This is advantageous in loops, file names etc.
Comments
Post a Comment