Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions module-generic/ReadWrite.C
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.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "fixedValueFvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "mixedFvPatchFields.H"

using namespace Foam;

Expand Down Expand Up @@ -35,6 +36,14 @@ void preciceAdapter::Generic::ScalarFieldCoupler::initialize()
{
adapterInfo("Generic module: The gradient operation is not yet supported for scalar fields. Maybe you meant surface-normal-gradient?", "error");
}

if (fieldConfig_.operation == "ref-value" || fieldConfig_.operation == "ref-gradient" || fieldConfig_.operation == "value-fraction")
{
if (this->locationType_ != LocationType::faceCenters)
{
adapterInfo("Generic module: Robin boundary conditions (ref-value, ref-gradient, and value-fraction operations) are supported only for surface locations (faceCenters).", "error");
}
}
}


Expand Down Expand Up @@ -173,14 +182,35 @@ void preciceAdapter::Generic::ScalarFieldCoupler::read(double* buffer, const uns
boundaryPatch.gradient()[i] = buffer[bufferIndex++];
}
}
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.

{
forAll(boundaryPatch, i)
{
boundaryPatch.refValue()[i] = buffer[bufferIndex++];
}
}
else if (fieldConfig_.operation == "ref-gradient")
{
forAll(boundaryPatch, i)
{
boundaryPatch.refGrad()[i] = buffer[bufferIndex++];
}
}
else if (fieldConfig_.operation == "value-fraction")
{
forAll(boundaryPatch, i)
{
boundaryPatch.valueFraction()[i] = buffer[bufferIndex++];
}
}
}
else
{
adapterInfo("Generic module: Unsupported boundary condition type " + bc.type(), "error");
}

// // evaluate the boundary condition, i.e., do some calculation to obtain the actual value provided refValue
// boundaryPatch.updateCoeffs();
// boundaryPatch.evaluate();
}
}

Expand Down