-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constraining dof > ndofs(dh) fails #1009
Comments
Posting workaround here that can be used untill we decide how to fix this struct DHWrapper{DH<:DofHandler} <: Ferrite.AbstractDofHandler
dh::DH
ndofs::Int
end
@inline Base.getproperty(dh::DHWrapper, f::Symbol) = Base.getproperty(Base.getfield(dh, :dh), f)
@inline Ferrite.ndofs(dh::DHWrapper) = Base.getfield(dh, :ndofs) which allows
and seems to work fine (which is very nice to see regarding hackability). |
If a user wants to add global Lagrange multipliers/dofs, I think it should be possible to add these to the DofHandler directly, e.g. |
Yes, that would be the solution here I guess: https://github.com/Ferrite-FEM/Ferrite.jl/pull/596/files (but with better names, global dofs is probably a good one) An alternative is adding a "GlobalInterpolation" that we discussed earlier on slack. These dofs are part of the celldof for each cell in the subdofhandler (master...kam/GlobalDofs). It would also be possible to have two variants, one connected to cells and one not connected? |
What is wrong about adding a
(and e.g. a Connector which behaves similar to a line element)? I kinda started liking this idea, because it is also nice for the integration with visualization pipelines. |
To me, the issue is that the coordinate is a dummy coordinate. In my application, the dofs could represent e.g. strain components, and I don't like if we require adding coordinates to this. For a flexible |
Why? Isn't the strain associated to some point or region?
I was not talking about actual beams or springs here, but about some entity that connects with other entities. For example you have one additional dof, e.g. some pressure within a sphere, connected to the elements on the sphere inner surface. So you can have fine grained control on your geometry while setting up your problem and the dof handler handles everything for you (assuming you also provide some dummy interpolation to tell the dof handler how the dofs need to be connected). If you want to introduce some affine constraint with it, then you can now easily query all information from your new element instead of doing it manually. |
The entire domain. But the point is, the coordinate has not meaning.
Aha, now I understand. Yes, for such cases I agree that adding an additional physical node can make sense (especially for visualization purposes). When doing that for my last conference, I needed to integrate over the face though, so I couldn't have used I think you proposed this earlier, but to this problem I think I would find it most natural to have a custom dh = DofHandler(grid)
main_sdh = SubDofHandler(dh, 1:getncells(grid))
add!(main_sdh, :p, ipp) # Regular fields
add!(main_sdh, :u, ipu) # Regular fields
for pore in pores # collection of OrderedSet{FacetIndex} or similar
pore_fdh = FacetDofHandler(dh, pore)
add!(pore_fdh, :pp, 1) # One pore pressure
add!(pore_fdh, :whatever, <num_pore_dofs>)
end
close!(dh) Since for each But my conclusion is that supporting this type of extra dof is different from supporting Lagrange-multiplier dofs or AffineConstraint-only dofs. Hence, my proposed solution would be to go with @lijas suggestion to be able to add extra global dofs to the dofhandler - i.e. saying that I also support @termi-official suggestion that we should provide a way to solve these surface-interactions, and I think this is an interesting discussion to figure out what is the most flexible way to do! |
Thanks for elaborating.
No need for this. For most practical purposes you can add some elements to your mesh which model the surface and simply add a SubDofHandler on this subdomain. This should already work out of the box on master. I will try this out in Thunderbolt soon and report back when I run into issues and we need intervention. Currently I simply manage the additional dofs manually. |
Cool - looking forward to seeing the solution! |
With the nice new SparsityPattern (#888), we can now extend the equation system beyond ndofs(dh). (I'm seeing how #596 could work now without changing the dofhandler).
I realized now that the
ConstraintHandler
fails if adding constraints to these, since it assumes the maximum size is ndofs(dh). (This now happens in_sorted_setdiff!
from #860 , before I thinkch.free_dofs
would simply be wrong but not error). In other places, we usendofs(ch.dh)
to check dimensions of the "to-be-constrained" vector, but this should really check forlast(ch.prescribed_dofs)
to be safe from out of bounds access.An easy solution would be to add an optional keyword arg to
ConstraintHandler(dh::DofHandler; n_dofs=ndofs(dh))
, but I'm also not sure what we should call this sincendofs
is taken for the function name. Anyone have some thoughts on this?MWE
Gives
ERROR: BoundsError: attempt to access 8-element Vector{Int64} at index [9]
The text was updated successfully, but these errors were encountered: