Hello
I did not find any fish for the fragment in UDEC. How to iterating through all the fragment and find the specific fragment ID and calculate the volume or area of the specific fragment?
I assume by saying fragment, you are referring to a joint segment. UDEC joints do not have volume or area. You can calculate an “area” by assuming an initial opening and subtracting the contact displacement and multiplying by length. Also, UDEC does have JOINT ID’s but they are not very useful. UDEC uses index values to address contact data.
fish define joint_data
iac = block.contact.head()
loop while iac # 0
id = block.contact.id(iac)
l = block.contact.length(iac)
d = block.contact.disp.normal(iac)
end_loop
end
UDEC does have domains which do have volume. some of the domains would represent the joint area, but some represent the area of joint intersections. The areas of the domains are only calculated in fluid flow models.
fish define domain_volume
iad = block.domain.head()
loop while iad # 0
v = block.domain.volume(iad)
io.out(string(v))
end_loop
end
@domain_volume
Attached are some FISH functions which output information about UDEC entities. They may also be helpful to understand how the entities are related.
; Function prints infos of a block which has index number n
fish define info_block(n)
local RIGID = 1
local DEFORM = 3
io.out("****************************************************")
local iab = index(n)
io.out(string.build("Block %1", index(iab)))
io.out(string.build("Centroid location: %1", block.pos(iab)))
io.out(string.build("Block area = %1", block.area(iab)))
io.out(string.build("Block material = %1", block.mat(iab)))
io.out(string.build("Slots / groups: %1", block.group(iab, "Any")))
if block.type(iab) == RIGID then
io.out(string.build("Block type = %1 = Rigid block", block.type(iab)))
io.out(string.build("Block model = %1", block.model(iab)))
else if block.type(iab) == DEFORM then
io.out(string.build("Block type = %1 = Deformable block", block.type(iab)))
local iaz = block.zone(iab)
io.out(string.build("Zone model = %1", block.zone.model(iaz)))
else
io.out(string.build("Block type = %1 = ?", block.type(iab)))
endif
; Count all corners of the block.
; Note: The corner list is circular and not zero terminated.
local nc = 0
local ic_first = block.corner(iab) ; index of first corner of the block
local iac = index(0)
loop while iac # ic_first
if iac == index(0) then
iac = ic_first
endif
nc += 1
iac = block.corner.next(iac)
endloop
; Count all gridpoints of the block.
local ng = 0
local iag = block.gp(iab)
loop while iag # index(0)
ng += 1
iag = block.gp.next(iag)
endloop
; Count all zones of the block.
local nz = 0
iaz = block.zone(iab)
loop while iaz # index(0)
nz += 1
iaz = block.zone.next(iaz)
endloop
; Count all contacts of the block.
local nk = 0
local iak = block.contact.head
loop while iak # index(0)
local b1 = block.contact.block1(iak)
local b2 = block.contact.block2(iak)
if b1 == iab | b2 == iab then
nk += 1
endif
iak = block.contact.next(iak)
endloop
io.out(string.build("Number of corners: %1", nc))
io.out(string.build("Number of gridpoints: %1", ng))
io.out(string.build("Number of zones: %1", nz))
io.out(string.build("Number of contacts: %1", nk))
io.out("****************************************************\n")
end
fish define corners_of_block(n)
io.out("****************************************************")
local iab = index(n)
io.out(string.build("Corners of block %1 at %2", index(iab), block.pos(iab)))
; Get all corners of the block. The corners list is circular.
io.out("Index, Location")
io.out("-----------------------")
local nc = 0
local ic_first = block.corner(iab) ; index of first corner of the block
local iac = index(0)
loop while iac # ic_first
if iac == index(0) then
iac = ic_first
endif
nc += 1
io.out(string.build(" %1\t %2", int(index(iac)), block.corner.pos(iac)))
iac = block.corner.next(iac)
endloop
io.out(string.build("\nNumber of corners: %1", nc))
io.out("****************************************************\n")
end
fish define gridpoints_of_block(n)
io.out("****************************************************")
local iab = index(n)
io.out(string.build("Gridpoints of block %1 at %2", index(iab), block.pos(iab)))
io.out("Index, Location")
io.out("-----------------------")
local ng = 0
local iag = block.gp(iab)
loop while iag # index(0)
ng += 1
io.out(string.build(" %1\t %2", int(index(iag)), block.gp.pos(iag)))
iag = block.gp.next(iag)
endloop
io.out(string.build("\nNumber of gridpoints: %1", ng))
io.out("****************************************************\n")
end
fish define zones_of_block(n)
io.out("****************************************************")
local iab = index(n)
io.out(string.build("Zones of block %1 at %2", index(iab), block.pos(iab)))
io.out("Index, Centroid, Area")
io.out("-----------------------")
local nz = 0
local iaz = block.zone(iab)
loop while iaz # index(0)
nz += 1
io.out(string.build(" %1\t %2\t %3", ...
int(index(iaz)), block.zone.pos(iaz), block.zone.area(iaz)))
iaz = block.zone.next(iaz)
endloop
io.out(string.build("\nNumber of zones: %1", nz))
io.out("****************************************************\n")
end
fish define contacts_of_block(n)
io.out("****************************************************")
local iab = index(n)
io.out(string.build("Contacts of block %1 at %2", index(iab), block.pos(iab)))
io.out("Index, Location, Normal, Length, Norm. Displacement")
io.out("----------------------------------------------------")
local nc = 0
local iac = block.contact.head
loop while iac # index(0)
local b1 = block.contact.block1(iac)
local b2 = block.contact.block2(iac)
if b1 == iab | b2 == iab then
nc += 1
io.out(string.build("%1\t %2\t %3\t %4\t %5", ...
int(index(iac)), block.contact.pos(iac), ...
block.contact.normal(iac), ...
block.contact.length(iac), ...
block.contact.disp.normal(iac)))
endif
iac = block.contact.next(iac) ; next contact
endloop
io.out(string.build("\nBlock %1 has %2 contacts", n, nc))
io.out("****************************************************\n")
end
; Function prints infos of a zone which has index number n
fish define info_zone(n)
io.out("****************************************************")
local iaz = index(n)
io.out(string.build("Zone %1", index(iaz)))
io.out(string.build("Model = %1", block.zone.model(iaz)))
io.out(string.build("Centroid location: %1", block.zone.pos(iaz)))
io.out(string.build("Zone area = %1", block.zone.area(iaz)))
io.out(string.build("Zone material = %1", block.zone.mat(iaz)))
io.out(string.build("Zone group = %1", block.zone.group(iaz)))
io.out("Stress")
io.out(string.build("sxx = %1", block.zone.stress.xx(iaz)))
io.out(string.build("syy = %1", block.zone.stress.yy(iaz)))
io.out(string.build("szz = %1", block.zone.stress.zz(iaz)))
io.out(string.build("sxy = %1", block.zone.stress.xy(iaz)))
local iab = block.zone.block(iaz)
io.out(string.build("\nZone belongs to block %1", index(iab)))
io.out("\nThe 3 surrounding gridpoints of the zone")
io.out("Index, Location, Displacement")
io.out("------------------------------")
loop local i(1,3)
local iag = block.zone.gp(iaz, i)
io.out(string.build(" %1\t %2\t %3", ...
int(index(iag)), block.gp.pos(iag), block.gp.disp(iag)))
endloop
io.out("****************************************************\n")
end
fish define info_gridpoint(n)
io.out("****************************************************")
local iag = index(n)
io.out(string.build("Gridpoint %1", index(iag)))
io.out(string.build("Location: %1", block.gp.pos(iag)))
io.out(string.build("Displacement = %1", block.gp.disp(iag)))
io.out(string.build("Velocity = %1", block.gp.vel(iag)))
io.out(string.build("Force = %1", block.gp.force(iag)))
local x = block.gp.pos.x(iag)
local y = block.gp.pos.y(iag)
local iaz = block.zone.inside(x,y)
io.out("\nOther information")
io.out(string.build("A zone containing this gridpoint: Zone %1 at %2", ...
int(index(iaz)), block.zone.pos(iaz)) )
local iab = block.gp.block(iag)
io.out(string.build("Associated block: %1 at %2", int(index(iab)), block.pos(iab) ))
local iac = block.gp.corner(iag)
io.out(string.build("Associated corner: %1 at %2", int(index(iac)), block.corner.pos(iac) ))
io.out("****************************************************\n")
end
fish define info_contact(n)
io.out("****************************************************")
local iac = index(n) ; convert number to index at corner
io.out(string.build("Contact %1", index(iac)))
io.out(string.build("Model = %1 = %2", ...
block.contact.model(iac), ...
block.contact.cmodel(iac)))
io.out(string.build("Location: %1", block.contact.pos(iac)))
io.out(string.build("Normal = %1", block.contact.normal(iac)))
local len = block.contact.length(iac)
io.out(string.build("Length = %1", len))
local un = block.contact.disp.normal(iac)
io.out(string.build("Normal disp. = %1", un))
io.out(string.build("Shear disp. = %1", block.contact.disp.shear(iac)))
io.out(string.build("Normal force = %1", block.contact.force.normal(iac)))
io.out(string.build("Shear force = %1", block.contact.force.shear(iac)))
io.out("")
local i = block.contact.type(iac)
local line = string.build("Corner type = %1", i)
caseof i
line += " = ?"
case 1
line += " = corner/corner"
case 2
line += " = corner/edge"
case 3
line += " = edge/corner"
endcase
io.out(line)
io.out(string.build("State = %1", block.contact.state(iac)))
io.out(string.build("Id = %1", block.contact.id(iac)))
io.out("\nThe 2 blocks that belong to this contact:")
local b1 = block.contact.block1(iac)
local b2 = block.contact.block2(iac)
io.out(string.build(" Block 1: %1 at %2", ...
index(b1), block.pos(b1)))
io.out(string.build(" Groups: %1", block.group(b1, "Any")))
io.out(string.build(" Material: %1", block.mat(b1)))
io.out(string.build("\n Block 2: %1 at %2", ...
index(b2), block.pos(b2)))
io.out(string.build(" Groups: %1", block.group(b2, "Any")))
io.out(string.build(" Material: %1", block.mat(b2)))
io.out("\nThe 2 domains that belong to this contact:")
local d1 = block.contact.domain1(iac)
local d2 = block.contact.domain2(iac)
io.out(string.build(" Domain 1: %1 at (%2, %3)", ...
index(d1), block.domain.pos.x(d1), block.domain.pos.y(d1)))
io.out(string.build(" Domain 2: %1 at (%2, %3)", ...
index(d2), block.domain.pos.x(d2), block.domain.pos.y(d2)))
io.out("****************************************************\n")
end
fish define info_domain(n)
io.out("****************************************************")
local iad = index(n)
io.out(string.build("Domain %1", index(iad)))
io.out(string.build("Location: (%1, %2)", ...
block.domain.pos.x(iad), block.domain.pos.y(iad)))
io.out(string.build("Volume = %1", block.domain.volume(iad)))
if block.domain.fix(iad) > 0 then
io.out(string.build("Pressure condition, fix = %1 = fixed", ...
block.domain.fix(iad)))
else
io.out(string.build("Pressure condition, fix = %1 = free", ...
block.domain.fix(iad)))
endif
io.out(string.build("Pore pressure = %1", block.domain.pp(iad)))
io.out("\nThe contacts that belong to this domain:")
local i = 0
local iac = block.domain.contact(iad, index(0))
loop while iac # index(0)
i += 1
io.out(string.build(" Contact %1: %2 at %3", ...
i, index(iac), block.contact.pos(iac)))
iac = block.domain.contact(iad, iac) ; next contact
endloop
io.out("****************************************************\n")
end
Hello,
I am working with voronoi tessellation to simulate different laboratory tests such as uniaxial, triaxial compression, mode I fracture toughness, … and looking for a FISH script to output the orientation of contacts that have failed (Tensile and shear cracks). Has anyone already tried to develop FISH script for this. I have already count the tensile and shear cracks of model.
any examples would be greatly appreciated.
Thank you
The normal to the crack/contact is potentially already a property that can be extracted? If not, for each shear or tensile crack, extract the x,y,z of the gridpoint at each end of the crack, and calculate the vector between these two locations. The orientation of this vector will be the crack orientation.