Skip to content

Commit

Permalink
Merge pull request #291 from precice/hotfix-v1.2.3
Browse files Browse the repository at this point in the history
Bugfix release v1.2.3
  • Loading branch information
davidscn authored Jun 20, 2023
2 parents 4b6ad03 + 5814621 commit 0acfa0f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 12 deletions.
5 changes: 3 additions & 2 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"MD013": false,
"MD033": false
}
"MD033": false,
"MD034": false
}
2 changes: 1 addition & 1 deletion Adapter.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ preciceAdapter::Adapter::Adapter(const Time& runTime, const fvMesh& mesh)
: runTime_(runTime),
mesh_(mesh)
{
adapterInfo("Loaded the OpenFOAM-preCICE adapter - v1.2.2.", "info");
adapterInfo("Loaded the OpenFOAM-preCICE adapter - v1.2.3.", "info");

return;
}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Read more details in the issue [#52: Releases and versioning](https://github.com

<!-- markdownlint-configure-file {"MD024": { "siblings_only": true } } -->

## [v1.2.3] 2023-06-14

### Fixed

- Fixed incorrect reading and writing of the FSI-related data buffers, if multiple patches are combined in an interface mesh [commit 846affd](https://github.com/precice/openfoam-adapter/commit/846affdd00ea8024cee98f34d8ad4205fdc83c5f).

## [v1.2.2] 2022-01-03

### Changed
Expand Down
12 changes: 7 additions & 5 deletions FSI/Displacement.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv

if (this->locationType_ == LocationType::faceCenters)
{
int bufferIndex = 0;
// For every boundary patch of the interface
for (const label patchID : patchIDs_)
{
Expand All @@ -56,7 +57,7 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv
forAll(cellDisplacement_->boundaryField()[patchID], i)
{
for (unsigned int d = 0; d < dim; ++d)
buffer[i * dim + d] =
buffer[bufferIndex++] =
cellDisplacement_->boundaryField()[patchID][i][d];
}
}
Expand All @@ -69,6 +70,7 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv
"See https://github.com/precice/openfoam-adapter/issues/153.",
"warning"));

int bufferIndex = 0;
// For every boundary patch of the interface
for (const label patchID : patchIDs_)
{
Expand All @@ -80,7 +82,7 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv
mesh_.boundaryMesh()[patchID].meshPoints();

for (unsigned int d = 0; d < dim; ++d)
buffer[i * dim + d] =
buffer[bufferIndex++] =
pointDisplacement_->internalField()[meshPoints[i]][d];
}
}
Expand All @@ -91,21 +93,21 @@ void preciceAdapter::FSI::Displacement::write(double* buffer, bool meshConnectiv
// return the displacement to use later in the velocity?
void preciceAdapter::FSI::Displacement::read(double* buffer, const unsigned int dim)
{
int bufferIndex = 0;
for (unsigned int j = 0; j < patchIDs_.size(); j++)
{
// Get the ID of the current patch
const unsigned int patchID = patchIDs_.at(j);

if (this->locationType_ == LocationType::faceCenters)
{

// the boundaryCellDisplacement is a vector and ordered according to the iterator j
// and not according to the patchID
// First, copy the buffer data into the center based vectorFields on each interface patch
forAll(cellDisplacement_->boundaryField()[patchID], i)
{
for (unsigned int d = 0; d < dim; ++d)
cellDisplacement_->boundaryFieldRef()[patchID][i][d] = buffer[i * dim + d];
cellDisplacement_->boundaryFieldRef()[patchID][i][d] = buffer[bufferIndex++];
}

if (pointDisplacement_ != nullptr)
Expand All @@ -132,7 +134,7 @@ void preciceAdapter::FSI::Displacement::read(double* buffer, const unsigned int
forAll(pointDisplacement_->boundaryFieldRef()[patchID], i)
{
for (unsigned int d = 0; d < dim; ++d)
pointDisplacementFluidPatch[i][d] = buffer[i * dim + d];
pointDisplacementFluidPatch[i][d] = buffer[bufferIndex++];
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions FSI/DisplacementDelta.C
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void preciceAdapter::FSI::DisplacementDelta::write(double* buffer, bool meshConn
// return the displacement to use later in the velocity?
void preciceAdapter::FSI::DisplacementDelta::read(double* buffer, const unsigned int dim)
{
int bufferIndex = 0;
for (unsigned int j = 0; j < patchIDs_.size(); j++)
{
// Get the ID of the current patch
Expand All @@ -65,7 +66,7 @@ void preciceAdapter::FSI::DisplacementDelta::read(double* buffer, const unsigned
forAll(cellDisplacement_->boundaryField()[patchID], i)
{
for (unsigned int d = 0; d < dim; ++d)
cellDisplacement_->boundaryFieldRef()[patchID][i][d] = buffer[i * dim + d];
cellDisplacement_->boundaryFieldRef()[patchID][i][d] = buffer[bufferIndex++];
}
// Get a reference to the displacement on the point patch in order to overwrite it
vectorField& pointDisplacementFluidPatch(
Expand All @@ -88,7 +89,7 @@ void preciceAdapter::FSI::DisplacementDelta::read(double* buffer, const unsigned
forAll(pointDisplacement_->boundaryFieldRef()[patchID], i)
{
for (unsigned int d = 0; d < dim; ++d)
pointDisplacementFluidPatch[i][d] += buffer[i * dim + d];
pointDisplacementFluidPatch[i][d] += buffer[bufferIndex++];
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion FSI/Force.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void preciceAdapter::FSI::Force::read(double* buffer, const unsigned int dim)
// Here we assume that a force volVectorField exists, which is used by
// the OpenFOAM solver

int bufferIndex = 0;
// Set boundary forces
for (unsigned int j = 0; j < patchIDs_.size(); j++)
{
Expand All @@ -63,7 +64,7 @@ void preciceAdapter::FSI::Force::read(double* buffer, const unsigned int dim)
forAll(force, i)
{
for (unsigned int d = 0; d < dim; ++d)
force[i][d] = buffer[i * dim + d];
force[i][d] = buffer[bufferIndex++];
}
}
else if (this->locationType_ == LocationType::faceNodes)
Expand Down
3 changes: 2 additions & 1 deletion FSI/ForceBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void preciceAdapter::FSI::ForceBase::writeToBuffer(double* buffer,
// Pressure boundary field
const auto& pb = mesh_.lookupObject<volScalarField>("p").boundaryField();

int bufferIndex = 0;
// For every boundary patch of the interface
for (const label patchID : patchIDs_)
{
Expand Down Expand Up @@ -183,7 +184,7 @@ void preciceAdapter::FSI::ForceBase::writeToBuffer(double* buffer,
forAll(forceField.boundaryField()[patchID], i)
{
for (unsigned int d = 0; d < dim; ++d)
buffer[i * dim + d] =
buffer[bufferIndex++] =
forceField.boundaryField()[patchID][i][d];
}
}
Expand Down

0 comments on commit 0acfa0f

Please sign in to comment.