Replies: 2 comments 8 replies
-
|
Nice work! There are some potential improvements to the above code that the following should fix:
Ferrite.get_n_copies(::Interpolation) = 1 # Extend internal function to work for non-vectorized interpolations
function node_to_dof(dh, fieldname)
grid = Ferrite.get_grid(dh)
ip = Ferrite.getfieldinterpolation(first(dh.subdofhandlers), fieldname);
dofmap = zeros(Int, Ferrite.get_n_copies(ip)::Int, getnnodes(grid));
for sdh in dh.subdofhandlers
node_to_dof!(dofmap, sdh, fieldname)
end
return dofmap
end
function node_to_dof!(dofmap::Matrix{Int}, sdh, fieldname)
if geometric_interpolation(getcelltype(sdh)) != Ferrite.get_base_interpolation(Ferrite.getfieldinterpolation(sdh, fieldname))
throw(ArgumentError("A node to dof map is only possible for isoparametric elements (same function and geometric interpolation)"))
end
grid = Ferrite.get_grid(dh)
ndofs_per_node = size(dofmap, 1)
for cell in CellIterator(sdh)
for (i, nodeidx) in enumerate(getnodes(cell))
for j in 1:ndofs_per_node
dofidx = dof_range(sdh, fieldname)[ndofs_per_node * (i - 1) + j]
dofmap[j, nodeidx] = celldofs(cell)[dofidx]
end
end
end
return dofmap
endIn the case you've tested above, the result is the same so I don't think this will actually make it work differently. Could you elaborate what you mean by "doesn't work" for |
Beta Was this translation helpful? Give feedback.
5 replies
-
|
What I'm still not sure about is
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear @KnutAM,
@KianAghani, @Kevin-Mattheus-Moerman and I developed the following code for nodal force, for now just a simple case.
The code works well for quad4 element for different boundary conditions, but for tri3 when we have shared nodes with Dirichlet boundary condition only works when
Lx, Ly = 1.0, 1.0
nx, ny = 1, 1
When we don't have share node it works for tri3 as well. Also node_to_dof function works well for assigning dof for nodes and we can add it to ferrite if we could solve the problem for tri3 that I think comes from apply!(K, f_ext, ch),
What do you think? then in two examples we could do a pull request to add the functionality if you like it.
We think, node_to_dof(dh) function does the job.
Beta Was this translation helpful? Give feedback.
All reactions