-
Notifications
You must be signed in to change notification settings - Fork 6
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
Remove references to coefficients from boundary conditions #53
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
@alexanderianblair I'd like to add some more unit tests, to cover the essential BCs. However, it's not clear to me how we should do that. Reading the GridFunction documentation, it doesn't look like it's trivial to check that a Dirichlet BC has been applied to the correct boundary. Do you have any suggestions? |
Essential BCs remove (true) DoFs from the bilinear form (operator) corresponding to that variable in the For a more robust test, you could also check that the essential DoFs have indeed been eliminated from the bilinear form of a test problem - may be overkill given existing tests in MFEM, though. |
@alexanderianblair I've written some initial tests for the Dirichlet boundary conditions (currently just checking that everything runs, not checking it actually does what's expected). The tests for tangential vector Dirichlet boundaries keep segfaulting and I'm at a bit of a loss as to why. I suspect it's because something hasn't been initialised correctly in the tests. Could you take a look and let me know if anything immediately stand out to you? |
Looks like it's the FESpace being used - the tangential vector BC is expecting a FE type with a vector basis (ND), so is failing because it's trying to set scalar DoFs in the FESpace using a 3D vector at each DoF. Using an FE variable based on an |
I think I've fixed the segfaults (on my computer at least). I'm not quite clear how to add the checks you described above, Would you be able to provide an example? That would probably be faster than trying to figure it out myself. |
…idfunction values on the boundary.
…est.MFEMScalarFunctionDirichletBC
I personally like what you guys had before better. Just because MOOSE has different classes for constant, function, material property, postprocessor, etc. based coefficients doesn't mean you should change what you're doing. We've been actually moving towards more class consolidation in MOOSE by using the functor system, from which variables, functions, functor material properties, and postprocessors all derive so that we don't need quadruplicate classes to cover what a user might leverage in their input file |
So there are currently three coefficient accessors on the problem (I think) that MFEM objects can use:
In practice all these objects care about is whether the coefficient is a |
I personally enjoyed being able to use the same |
This is useful to know that this is the direction MOOSE is going in - we definitely could have
IMO Option 1 would be more familiar for existing MOOSE users, and sounds closer to the UI MOOSE would have after moving to functors. |
I don't think it is correct to view properties and coefficients as the same things. Properties are are represented using coefficients, but they are subtly different. Properties are inherently piecewise, being defined on particular blocks. Even in the case where they are defined over all blocks, they are expressing information about what blocks they apply to. Coefficients, on the other hand, have no information about the blocks they apply to. The point of the PropertyManager class is to handle the assembling of properties gradually, as the input file is parsed. We don't find out all at once what the value/expression for each property is on each block; that gets defined one material at a time. There was previously a rather messy way to assemble that information (which I can't even remember, to be honest). The PropertyManager class keeps it simple for the end-user. I do not think it would be appropriate to mix the creation of Coefficients in with the PropertyManager class as it exists now. I suppose it would be possible to refactor it into some sort of coefficient manager class which takes on additional responsibilities, but I'm concerned that would lead to confusion about the distinction between coefficients and properties that I have described. |
I think it would be useful to have a clearer understanding of how that new approach will look in MOOSE then. I think ensuring consistency is an important virtue, so we should aim to make our approach match whatever will be coming in MOOSE. |
This isn't true, is it? Don't you guys leverage |
After discussion with @cmacmackin: we're conscious of the fact that Coefficients don't exist as a concept in vanilla MOOSE. As a result, we're keen to avoid them appearing as separate objects in HIT inputs as things currently stand, to minimise the barrier to entry for MOOSE users trying out the use of MFEM as an FE backend. That said, reducing the duplication of downstream objects (like BCs and Kernels) is very appealing. Current plan of attack is:
|
The plan sounds reasonable to me
Yea I like this. To elaborate more, I'd be fine with multiple database being unique/shared owners of different kinds of |
Co-authored-by: Alexander Blair <[email protected]>
Co-authored-by: Alexander Blair <[email protected]>
Co-authored-by: Alexander Blair <[email protected]>
@alexanderianblair Could you run Clang-format on the code to get the linting working? |
…r MFEMScalarFunctionDirichletBC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good intermediate step, removing Coefficients from user input files ahead of the follow-up PR introducing Platypus's equivalent to FunctorBCs.
Tests now all pass as expected.
This finally removes the
MFEMCoefficient
classes. That involves refactoring the boundary condition classes. There are now two versions of each type of boundary condition: one which takes constant values and one which takes a function name. It is a little messy needing to have these duplicate classes, but it is in-line with how MOOSE does these things.