You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having a how-to on calculating reaction forces and comparing the accuracy would probably be nice.
Is a good first issue, so providing some details from Slack:
Calculating the reaction forces can be done in two ways in Ferrite,
Calculate the traction at the boundary using the solution field to get the correct strains (and thus stresses), and then integrate to get the total reaction on the boundary.
Get the residual vector on the boundary by assembling the internal force vector considering the solution field, and extracting the constrained degrees of freedom (I usually use a dummy constraint handler to do this).
The second option is more accurate (specifically it will give the exact result if the loading was a body load), but the first option is a bit easier to implement. Both are mathematically correct and will converge to eachother assuming a sufficiently fine mesh.
The text was updated successfully, but these errors were encountered:
I had a similar problem before and it was solved in the second way as @KnutAM said. The code is below:
ch = ConstraintHandler(dh)
add!(ch, Dirichlet(:u, getfaceset(grid, "left"), Returns(zeros(2))))
add!(ch, Dirichlet(:u, getfaceset(grid, "right"), Returns(0.0), [2]))
close!(ch)
function FESolvers.postprocess!(p::PlasticityProblem, solver)
buf = p.buf
def = p.def
post = p.post
doassemble!(buf.cv, buf.fv, buf.K, buf.r,
def.dh.grid, def.dh, def.material, def.damage, buf.u, buf.states, buf.states_old, true)
dbc_force = sum(FESolvers.getresidual(p)[get_dbc_dofs(p.def,2)])
end;
function get_dbc_dofs(def,dbc_num::Int)
dbc = def.ch.dbcs[dbc_num]
bcfaces = dbc.faces
constrained_dofs = Int[]
cc = CellCache(def.ch.dh, UpdateFlags(; nodes=false, coords=false, dofs=true))
for (cellidx, faceidx) in bcfaces
reinit!(cc, cellidx)
r = dbc.local_face_dofs_offset[faceidx]:(dbc.local_face_dofs_offset[faceidx+1]-1)
append!(constrained_dofs, cc.dofs[dbc.local_face_dofs[r]])
end
return unique!(constrained_dofs)
end
If the query global_dofs can be added to each dbc of ch.dbcs, there is no need to write the above get_dbc_dofs function, and calculating reaction force will be much simpler. Then the only thing the user has to do is to add the focused dbc into the ch.
Having a how-to on calculating reaction forces and comparing the accuracy would probably be nice.
Is a good first issue, so providing some details from Slack:
Calculating the reaction forces can be done in two ways in Ferrite,
The second option is more accurate (specifically it will give the exact result if the loading was a body load), but the first option is a bit easier to implement. Both are mathematically correct and will converge to eachother assuming a sufficiently fine mesh.
The text was updated successfully, but these errors were encountered: