Skip to content

Implement mixed boundary condition (Robin) in Generic module#400

Open
vidulejs wants to merge 3 commits intodevelopfrom
mixed-boundary-condition
Open

Implement mixed boundary condition (Robin) in Generic module#400
vidulejs wants to merge 3 commits intodevelopfrom
mixed-boundary-condition

Conversation

@vidulejs
Copy link
Collaborator

@vidulejs vidulejs commented Mar 8, 2026

Implemented mixed boundary condition (Robin) in Generic module. This allows to replicate, for example, CHT cases where there are Sink-Temperature and Heat-Transfer-Coefficient coupling data. I've been able to validate the implementation on the tutorial heat-exchanger (pictures to follow).

There are new operation options available to set the mixed boundary conditions when reading data from preCICE:

  • ref-value
  • ref-gradient
  • value-fraction,
    which will set the respective fields in the OpenFOAM mixed BC.

To test the implementation standalone from the CHT module, I created a new tutorial case partitioned-heat-transfer-robin on my fork of the tutorials.

Here's the example preciceDict configuration for that case:

participant Left;

modules (generic);

interfaces
{
  Interface1
  {
    mesh              Left-Mesh;
    patches           (interface);
    
    readData
    (
      Sink-Temp
      {
        name        Temperature-Right;
        solver_name T;
        operation   ref-value;
      }
      HTC
      {
        name        Gradient-Right;
        solver_name T;
        operation   ref-gradient;
        flip-normal true;
      }
    );
    
    writeData
    (
      Write-Temp
      {
        name        Temperature-Left;
        solver_name T;
        operation   value;
      }
      Write-Grad
      {
        name        Gradient-Left;
        solver_name T;
        operation   surface-normal-gradient;
      }
    );
  };
};

TODO list:

  • I updated the documentation in docs/
  • I added a changelog entry in changelog-entries/ (create directory if missing)

@vidulejs vidulejs marked this pull request as draft March 8, 2026 23:42
@vidulejs vidulejs marked this pull request as ready for review March 10, 2026 09:25
Copy link
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, some minor suggestions.

From our discussion: The robin test case would also be nice to have as a tutorial, with the new schema, to use as a test case.

Reply by @vidulejs: We don't have the complete support yet, as we are missing the conductivity calculation. In this case, it happens to work because the coefficient is 1. In that sense, adding this tutorial wouldbe misleading at the moment.

Comment on lines 169 to 171
if (isA<fixedValueFvPatchScalarField>(bc))
{
auto& boundaryPatch = refCast<fixedValueFvPatchScalarField>(bc);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add similar checks and error messages here: if not a supported operation for this BC type, throw an error.

else if (isA<mixedFvPatchScalarField>(bc))
{
auto& boundaryPatch = refCast<mixedFvPatchScalarField>(bc);
if (fieldConfig_.operation == "ref-value" || fieldConfig_.operation == "value")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment for the motivation for both checks here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a changelog entry as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants