From 28545487fd02b3f742e7bd5435b01a42f10c28d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Tue, 20 Feb 2024 15:24:58 +0100 Subject: [PATCH 1/6] Add pre-commit --- .pre-commit-config.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b8d81e5 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: +# Official repo for default hooks +- repo: https://github.com/precice/precice-pre-commit-hooks + rev: 'v3.2' + hooks: + - id: format-precice-config + files: "^.*/precice-config.xml" + - id: check-image-prefix + args: [ --prefix=docs-tooling-fmi-runner- ] +- repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.39.0 + hooks: + - id: markdownlint + files: "^docs/.*.md" + - id: markdownlint-fix + files: "^docs/.*.md" From d2d869223ca56de096e9d1ef17b271632be03656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Tue, 20 Feb 2024 15:25:18 +0100 Subject: [PATCH 2/6] Format docs --- docs/README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/README.md b/docs/README.md index e874a8d..3f2c5f7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,7 +9,7 @@ summary: A tool to execute FMUs and couple them to PDE-based solvers using preCI The [Functional Mock-Up Interface](https://fmi-standard.org/) (FMI) is a standard for the exchange of dynamic simulation models. Currently, it is the de-facto industry standard for co-simulation. Models implementing the FMI standard are called Functional Mock-Up Units (FMU). -The preCICE-FMI runner contains the script `fmiprecice` to couple FMU models with other simulation tools via [preCICE](https://precice.org/). The runner serves as an importer for the FMU to steer the simulation. Additionally, the runner calls the preCICE library to communicate and coordinate with other solvers. +The preCICE-FMI runner contains the script `fmiprecice` to couple FMU models with other simulation tools via [preCICE](https://precice.org/). The runner serves as an importer for the FMU to steer the simulation. Additionally, the runner calls the preCICE library to communicate and coordinate with other solvers. ![img](images/tooling-fmi-runner-setup.png) @@ -21,7 +21,7 @@ The runner is called from the terminal with the command `fmiprecice`. It takes t fmiprecice ./fmi-settings.json ./precice-settings.json ``` -Read on to find out how to install and configure the runner. More information about the software, its abilities, and its limitations can be found in [1]. If you are ready to run your first case, have a look at the [oscillator tutorial](https://github.com/LeonardWilleke/precice-tutorials/tree/create-fmu-oscillator-v2/oscillator). +Read on to find out how to install and configure the runner. More information about the software, its abilities, and its limitations can be found in [1]. If you are ready to run your first case, have a look at the [oscillator tutorial](https://github.com/LeonardWilleke/precice-tutorials/tree/create-fmu-oscillator-v2/oscillator). ## Get the Runner @@ -43,7 +43,7 @@ pip3 install numpy pip3 install fmpy ``` -### Installation +### Installation The software is [hosted on GitHub](https://github.com/precice/fmi-runner). Clone the repository and switch to the root directory: @@ -93,8 +93,8 @@ The file `fmi-settings.json` holds all the necessary information to run a simula "output": ["force", "position"] }, "model_params": { - "apply_filter": true, - "spring_coeff": 65.0 + "apply_filter": true, + "spring_coeff": 65.0 }, "initial_conditions": { "position": 0.0 @@ -157,9 +157,9 @@ The file `precice-settings.json` is used to configure the coupling with preCICE. Current limitations of the FMI runner software are: -- Can only be used with preCICE v2 and Co-Simulation FMUs (FMI 1,2,3) -- All accessed FMU variables are scalar -- Data can only be exchanged via one vertex. The exchange of multiple vertices or full meshes is not possible. +* Can only be used with preCICE v2 and Co-Simulation FMUs (FMI 1,2,3) +* All accessed FMU variables are scalar +* Data can only be exchanged via one vertex. The exchange of multiple vertices or full meshes is not possible. ## How to cite @@ -180,4 +180,3 @@ If you are using the FMI runner, pĺease consider citing the following Thesis: ## References [1] L. Willeke, [A preCICE-FMI Runner to couple controller models to PDEs](https://doi.org/10.18419/opus-13130), Master Thesis, University of Stuttgart, 2023 - From 55a82483c6f104cbb5ac806abbd9b33058067711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Tue, 20 Feb 2024 15:25:29 +0100 Subject: [PATCH 3/6] Format preCICE config --- tests/precice-config.xml | 57 +++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/tests/precice-config.xml b/tests/precice-config.xml index 3434e77..6af1859 100644 --- a/tests/precice-config.xml +++ b/tests/precice-config.xml @@ -1,50 +1,53 @@ - - + - - + - - - - - + + + - - - + - + - - - - - + + + + - + - - - - - + + + - - + + - From 209e3a0e956d28b98043d66d6b9b21511fdfba0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Tue, 20 Feb 2024 15:33:23 +0100 Subject: [PATCH 4/6] Integrate pep8 into pre-commit --- .github/workflows/check-pep8.yml | 22 ---------------------- .github/workflows/code-style.yml | 31 +++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 5 +++++ 3 files changed, 36 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/check-pep8.yml create mode 100644 .github/workflows/code-style.yml diff --git a/.github/workflows/check-pep8.yml b/.github/workflows/check-pep8.yml deleted file mode 100644 index 46ef531..0000000 --- a/.github/workflows/check-pep8.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: autopep8 -on: - push: - branches: - - main - - develop - pull_request: - branches: - - "*" -jobs: - autopep8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: autopep8 - id: autopep8 - uses: peter-evans/autopep8@v1 - with: - args: --recursive --diff --aggressive --aggressive --exit-code --ignore E402 --max-line-length 120 . - - name: Fail if autopep8 made changes - if: ${{ steps.autopep8.outputs.exit-code == 2 }} - run: exit 1 diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 0000000..2d84c50 --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,31 @@ +name: 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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b8d81e5..4c3064b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,3 +14,8 @@ repos: files: "^docs/.*.md" - id: markdownlint-fix files: "^docs/.*.md" +- repo: https://github.com/hhatto/autopep8 + rev: v2.0.4 + hooks: + - id: autopep8 + args: [ --in-place, --ignore=E402, --max-line-length=120 ] From 32fd7981a9d9e658610865b950a23e7596b8c601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Tue, 20 Feb 2024 15:40:12 +0100 Subject: [PATCH 5/6] Fix formatting --- .markdownlint.json | 5 +++++ docs/README.md | 2 +- ...-setup.png => docs-tooling-fmi-runner-setup.png} | Bin 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .markdownlint.json rename docs/images/{tooling-fmi-runner-setup.png => docs-tooling-fmi-runner-setup.png} (100%) diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..979cb28 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,5 @@ +{ + "MD013": false, + "MD033": false, + "MD034": false +} diff --git a/docs/README.md b/docs/README.md index 3f2c5f7..d33e7dd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,7 @@ The [Functional Mock-Up Interface](https://fmi-standard.org/) (FMI) is a standar The preCICE-FMI runner contains the script `fmiprecice` to couple FMU models with other simulation tools via [preCICE](https://precice.org/). The runner serves as an importer for the FMU to steer the simulation. Additionally, the runner calls the preCICE library to communicate and coordinate with other solvers. -![img](images/tooling-fmi-runner-setup.png) +![img](images/docs-tooling-fmi-runner-setup.png) ## Usage diff --git a/docs/images/tooling-fmi-runner-setup.png b/docs/images/docs-tooling-fmi-runner-setup.png similarity index 100% rename from docs/images/tooling-fmi-runner-setup.png rename to docs/images/docs-tooling-fmi-runner-setup.png From 686ccfe70973e93b20ffe07a2d40d2fb8bbe515e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simonis?= Date: Wed, 21 Feb 2024 13:04:44 +0100 Subject: [PATCH 6/6] Update .github/workflows/code-style.yml Co-authored-by: Benjamin Uekermann --- .github/workflows/code-style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 2d84c50..9981c7c 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -12,7 +12,7 @@ jobs: formatting: runs-on: ubuntu-latest steps: - - name: Checkout preCICE + - name: Checkout the FMI Runner uses: actions/checkout@v4 - name: Setup python uses: actions/setup-python@v5