pmgbergen / porepy

Python Simulation Tool for Fractured and Deformable Porous Media
GNU General Public License v3.0
251 stars 88 forks source link

1178 robin conditions in models #1187

Closed IngridKJ closed 4 months ago

IngridKJ commented 5 months ago

Proposed changes

Addresses issue #1178: Allow for usage of Robin type boundary conditions with the model class setups in PorePy.

This PR includes adding a robin operator parameter to the method _combine_boundary_operators(). In addition to this, each call to _combine_boundary_operators() is refactored into new methods specific for each physical problem, distinguished by their flux name:

Additionally: Fixes a problem of singular matrices related to nodes with only one subcell gradient but two or more boundary faces (for Robin conditions. This was already in place for Neumann).

Practicalities

The Robin conditions are implemented in the following form in PorePy: flux + alpha * potential = G. What is needed by the user to utilize such boundary conditions is to: In bc_type-methods:

In bc_values-methods:

Why refactoring the combine operators call? Tailoring of each operator is now easily achieved by just overriding the wrapper method (combine_boundaryoperators"flux_name"). Note: The default Robin operator is the same as the Neumann operator.

Types of changes

What types of changes does this PR introduce to PorePy? Put an x in the boxes that apply.

Checklist

Put an x in the boxes that apply or explain briefly why the box is not relevant.

OmarDuran commented 5 months ago

The question is general in nature. I believe that there is room for a unification of types and data, such as

Types:

Data:

IvarStefansson commented 5 months ago

Thank you for your contribution.

It is important to consider the following:

  • Perform a test to ensure that boundary segments labeled with Robin type do not intersect with other types;
  • Include a test for scalar and vector problem, for which Robin approximates the functionality of Dirichlet and Neumann;
  • Include a tutorial that illustrates how the boundary condition is intended to be used in the models.

To your first point, @OmarDuran, isn't that more a test for the BoundaryCondition class, rather than this Model integration?

@IvarStefansson It depends on how you define integration. The tutorial and test for boundary segment intersection can be seen as separate PRs.

IngridKJ commented 4 months ago

Thank you for the quick review, @OmarDuran. I have now addressed the suggested changes and comments, and all are covered in one way or another. The latest test I wrote (checking Robin limit case of alpha = 0 equals Neumann) is perhaps a bit brute force and could need some more fancy parametrization of sorts. I am however unsure how to adapt it...

IngridKJ commented 4 months ago

@IvarStefansson: PR is ready for (hopefully final) review now. I addressed your comment about nonzero boundary values, and after the meeting with you and Eirik today, I have also refactored the eliminate-asymmetric-stress-tensor functionality for Neumann/Robin.