Ferrite.jl icon indicating copy to clipboard operation
Ferrite.jl copied to clipboard

Relax error for 'function integrate_projected_dbc!(::HcurlConformity, Kᶠ, fᶠ, bc_fun, fv, shape_nrs, cell_coords, time)'

Open lucasbanting opened this issue 5 months ago • 1 comments

I was trying out the 3D Nedelec elements in the new ferrite version. The function function integrate_projected_dbc!(::HcurlConformity, Kᶠ, fᶠ, bc_fun, fv, shape_nrs, cell_coords, time) has throw(ArgumentError("ProjectedDirichlet is not implemented for 3D H(curl) conformity")). I tested commenting out the error, and I got correct results using zero-Dirichlet boundary conditions. Can this ArgumentError be removed, or be changed to warning instead?

I also think the ProjectedDirichlet docs should be updated, as it appears the required function signature is: bc_fun(x, time, n), but the docs implied to me that a function fun(x,time) should be used. It seems that bc_fun could be implicitly created as bc_fun(x, time, n) = cross(n, fun(x,time)) in the projected Dirichlet implementation.

lucasbanting avatar Jun 07 '25 18:06 lucasbanting

I also think the ProjectedDirichlet docs should be updated, as it appears the required function signature is: bc_fun(x, time, n), but the docs implied to me that a function fun(x,time) should be used.

Where did it say that fun(x,time) should be used? This is how the rendered docstring looks to me.

Image

Can this ArgumentError be removed, or be changed to warning instead?

Yes, we could support a zero-valued bc without adding more advanced logic. Some options would be

  • Support f::Returns and check that norm(f()) == 0 (more consistent with Dirichlet)
  • Support f::Number and check that norm(f) == 0 (would IMO be a nice addition also to Dirichlet, but adding just to ProjectedDirichlet would be a bit inconsistent).

As a temporary workaround, probably the first option is the minimal possible change. If you want to do a PR, I can review it (but probably I won't have time before in a couple of weeks).

KnutAM avatar Jun 18 '25 18:06 KnutAM

I was wrong about the documentation, thanks for the correction. I made a PR !1232 to support the first option.

lucasbanting avatar Sep 06 '25 14:09 lucasbanting