-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into add-tests-workflow
- Loading branch information
Showing
28 changed files
with
535 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Check code style | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
formatting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout preCICE | ||
uses: actions/checkout@v4 | ||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
check-latest: true | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Run checks | ||
run: pre-commit run -a -v | ||
- name: Git status | ||
if: always() | ||
run: git status | ||
- name: Full diff | ||
if: always() | ||
run: git diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
repos: | ||
# Official repo for default hooks | ||
- repo: https://github.com/precice/precice-pre-commit-hooks | ||
rev: 'v3.3' | ||
hooks: | ||
- id: format-precice-config | ||
- id: check-image-prefix | ||
args: [ --prefix=docs-adapter-openfoam- ] | ||
- repo: https://github.com/igorshubovych/markdownlint-cli | ||
rev: v0.30.0 | ||
hooks: | ||
- id: markdownlint | ||
files: "^docs/.*.md" | ||
- id: markdownlint-fix | ||
files: "^docs/.*.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#include "Alpha.H" | ||
|
||
using namespace Foam; | ||
|
||
preciceAdapter::FF::Alpha::Alpha( | ||
const Foam::fvMesh& mesh, | ||
const std::string nameAlpha) | ||
: Alpha_( | ||
const_cast<volScalarField*>( | ||
&mesh.lookupObject<volScalarField>(nameAlpha))) | ||
{ | ||
dataType_ = scalar; | ||
} | ||
|
||
std::size_t preciceAdapter::FF::Alpha::write(double* buffer, bool meshConnectivity, const unsigned int dim) | ||
{ | ||
int bufferIndex = 0; | ||
|
||
if (this->locationType_ == LocationType::volumeCenters) | ||
{ | ||
if (cellSetNames_.empty()) | ||
{ | ||
for (const auto& cell : Alpha_->internalField()) | ||
{ | ||
buffer[bufferIndex++] = cell; | ||
} | ||
} | ||
else | ||
{ | ||
for (const auto& cellSetName : cellSetNames_) | ||
{ | ||
cellSet overlapRegion(Alpha_->mesh(), cellSetName); | ||
const labelList& cells = overlapRegion.toc(); | ||
|
||
for (const auto& currentCell : cells) | ||
{ | ||
// Copy the alpha valus into the buffer | ||
buffer[bufferIndex++] = Alpha_->internalField()[currentCell]; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// For every boundary patch of the interface | ||
for (uint j = 0; j < patchIDs_.size(); j++) | ||
{ | ||
int patchID = patchIDs_.at(j); | ||
|
||
// For every cell of the patch | ||
forAll(Alpha_->boundaryFieldRef()[patchID], i) | ||
{ | ||
// Copy the Alpha into the buffer | ||
buffer[bufferIndex++] = | ||
Alpha_->boundaryFieldRef()[patchID][i]; | ||
} | ||
} | ||
return bufferIndex; | ||
} | ||
|
||
void preciceAdapter::FF::Alpha::read(double* buffer, const unsigned int dim) | ||
{ | ||
int bufferIndex = 0; | ||
|
||
if (this->locationType_ == LocationType::volumeCenters) | ||
{ | ||
if (cellSetNames_.empty()) | ||
{ | ||
for (auto& cell : Alpha_->ref()) | ||
{ | ||
cell = buffer[bufferIndex++]; | ||
} | ||
} | ||
else | ||
{ | ||
for (const auto& cellSetName : cellSetNames_) | ||
{ | ||
cellSet overlapRegion(Alpha_->mesh(), cellSetName); | ||
const labelList& cells = overlapRegion.toc(); | ||
|
||
for (const auto& currentCell : cells) | ||
{ | ||
// Copy the pressure into the buffer | ||
Alpha_->ref()[currentCell] = buffer[bufferIndex++]; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// For every boundary patch of the interface | ||
for (uint j = 0; j < patchIDs_.size(); j++) | ||
{ | ||
int patchID = patchIDs_.at(j); | ||
// For every cell of the patch | ||
forAll(Alpha_->boundaryFieldRef()[patchID], i) | ||
{ | ||
Alpha_->boundaryFieldRef()[patchID][i] = buffer[bufferIndex++]; | ||
} | ||
} | ||
} | ||
|
||
bool preciceAdapter::FF::Alpha::isLocationTypeSupported(const bool meshConnectivity) const | ||
{ | ||
if (meshConnectivity) | ||
{ | ||
return (this->locationType_ == LocationType::faceCenters); | ||
} | ||
else | ||
{ | ||
return (this->locationType_ == LocationType::faceCenters || this->locationType_ == LocationType::volumeCenters); | ||
} | ||
} | ||
|
||
std::string preciceAdapter::FF::Alpha::getDataName() const | ||
{ | ||
return "Alpha"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef FF_ALPHA_H | ||
#define FF_ALPHA_H | ||
|
||
#include "CouplingDataUser.H" | ||
|
||
#include "fvCFD.H" | ||
#include "cellSet.H" | ||
|
||
namespace preciceAdapter | ||
{ | ||
namespace FF | ||
{ | ||
|
||
//- Class that writes and reads Alpha | ||
class Alpha : public CouplingDataUser | ||
{ | ||
|
||
private: | ||
//- Alpha field | ||
Foam::volScalarField* Alpha_; | ||
|
||
public: | ||
//- Constructor | ||
Alpha( | ||
const Foam::fvMesh& mesh, | ||
const std::string nameAlpha); | ||
|
||
//- Write the Alpha values into the buffer | ||
std::size_t write(double* buffer, bool meshConnectivity, const unsigned int dim); | ||
|
||
//- Read the Alpha values from the buffer | ||
void read(double* buffer, const unsigned int dim); | ||
|
||
bool isLocationTypeSupported(const bool meshConnectivity) const override; | ||
|
||
//- Get the name of the current data field | ||
std::string getDataName() const override; | ||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
Oops, something went wrong.