diff --git a/module-generic/ReadWrite.C b/module-generic/ReadWrite.C index 873d4c11..975f67aa 100644 --- a/module-generic/ReadWrite.C +++ b/module-generic/ReadWrite.C @@ -4,6 +4,7 @@ #include "fixedValueFvPatchFields.H" #include "fixedGradientFvPatchFields.H" +#include "mixedFvPatchFields.H" using namespace Foam; @@ -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"); + } + } } @@ -173,14 +182,35 @@ void preciceAdapter::Generic::ScalarFieldCoupler::read(double* buffer, const uns boundaryPatch.gradient()[i] = buffer[bufferIndex++]; } } + else if (isA(bc)) + { + auto& boundaryPatch = refCast(bc); + if (fieldConfig_.operation == "ref-value" || fieldConfig_.operation == "value") + { + 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(); } }