Hello, I am using a package JuAFEM for generating a three grids. After merging the grids when I am trying to use the getfacesets function it does not show any faceset for the final merged grid, however it shows the facesets for individual grid. Below is the code:
using JuAFEM
using BlockArrays, SparseArrays, LinearAlgebra, Tensors
grid1 = generate_grid(QuadraticQuadrilateral,(10,10), Vec{2}((0.0,4.5)), Vec{2}((0.5,4.5)), Vec{2}((0.5,5.0)), Vec{2}((0.0,5.0)))
grid2 = generate_grid(QuadraticQuadrilateral,(10,10), Vec{2}((0.0,0.0)), Vec{2}((5.0,0.0)), Vec{2}((0.5,4.5)), Vec{2}((0.0,4.5)))
grid3 = generate_grid(QuadraticQuadrilateral,(10,10), Vec{2}((0.5,4.5)), Vec{2}((5.0,0.0)), Vec{2}((5.0,5.0)), Vec{2}((0.5,5.0)))
function merge_grids(grid1::Grid{dim,CellType}, grid2::Grid{dim,CellType}; tol=0.0001) where {N, dim, CellType <: Cell{<:Any, N}}
cells′ = copy(grid1.cells)
nodes′ = copy(grid1.nodes)
nodemap = Dict{Int,Int}()
next = getnnodes(grid1) + 1
for (i2, n2) in enumerate(grid2.nodes)
found = false
for (i1, n1) in enumerate(grid1.nodes)
if norm(n1.x - n2.x) < tol
nodemap[i2] = i1
found = true
break
end
end
if !found
push!(nodes′, n2)
nodemap[i2] = next
next += 1
end
end
for c in grid2.cells
t = ntuple(N) do i
return nodemap[c.nodes[i]]
end
cell′ = CellType(t)
push!(cells′, cell′)
end
return Grid(cells′, nodes′)
end
merge_grids(grid1::G, grid2::G, grids::G...) where G <: Grid =
merge_grids(merge_grids(grid1, grid2), grids...)
grid = merge_grids(grid1,grid2, grid3)
getfacesets(grid)
Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message ) (More Info)