libCEED icon indicating copy to clipboard operation
libCEED copied to clipboard

fluids: Refactor boundary condition handling

Open jrwrigh opened this issue 1 year ago • 1 comments

Currently in progress, but open to feedback. Currently, only the wall and symmetry BCs are converted over to the new BCDefinition format. Still deciding exactly how I want to handle the boundary integrals and Ceed-based essential BCs.

TODOs:

  • [ ] Make a unified essential BC mask and values vector (for handling time-varying and initial-condition based essential BCs)
  • [x] Add in a setup function for creating IFunction and IJacobian definitions
  • [ ] Figure out integration with strong Ceed-based BCs

Addresses the backend parts of #1090

jrwrigh avatar Apr 24 '24 22:04 jrwrigh

The code is now in a state of a working minimal example, so I'm hoping to get some feedback. To give a brief tour:

  • Define a BCDefinition struct
    • It's primary purpose is to:
    • A) define all the backend information necessary to create the BC (face labels, essential components, DM field, etc.)
    • B) store intermediary data related to the BC as it passes between steps (qfunction information predominately)
  • Define BCType enum to act as a marker for what various setup procedures need to be done for it
    • This was cleaner than trying to add in function pointers to do those setup procedures at an early stage IMO.

There are 4 primary steps.

  1. Read general bc info and write to an array of BCDefinition structs. Code link
  2. Set essential boundary conditions from the BCDefinition. Code link
  3. Run any extra setup functions needed for the BC, as determined by it's BCType. Here's the generic function which calls more specific functions based on the BCType.
  4. Create CeedOperators for the IFunction and IJacobian based on the QFunction information defined in step 3. Code link

Limitations of the current implementation:

  • The essential BCs are currently limited to constant-in-time values. Not sure how to go about doing time-varying values, but haven't put too much thought into it yet.
  • The freestream is the only natural BC currently implemented. Not sure how I want to handle the problem-specific inflow/outflow BCs yet.

Tagging @jeremylt and @zatkins-dev since y'all were involved the Ratel BC refactor discussion awhile ago.

jrwrigh avatar May 29 '24 01:05 jrwrigh

I've created https://github.com/CEED/libCEED/pull/1600 to try and break up this refactoring into multiple stages.

This first stage in #1600 adds in the BCDefinition struct and the time-independent essential BCs.

jrwrigh avatar Jun 07 '24 18:06 jrwrigh