Skip to content

Commit

Permalink
Merge branch 'develop' into adaptivity-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
IshaanDesai committed Apr 10, 2024
2 parents 350b840 + 6b721ec commit 1801c0b
Show file tree
Hide file tree
Showing 37 changed files with 728 additions and 400 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/check-links.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/check-markdown.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/run-adaptivity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:
pull_request:
branches:
- "*"
jobs:
jobs:
adaptivity_integration_tests:
name: Run adaptivity integration tests
runs-on: ubuntu-latest
container: precice/precice:nightly
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: micro-manager

Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
container: precice/precice:nightly
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: micro-manager

Expand All @@ -76,7 +76,7 @@ jobs:
container: precice/precice:nightly
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: micro-manager

Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run checks for markdown, links, and pre-commit
on:
push:
branches:
- main
- develop
pull_request:
branches:
- "*"
jobs:
check_md:
name: Lint markdown files
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Lint markdown files (markdownlint)
uses: articulate/actions-markdownlint@v1
with:
config: .markdownlint.json
files: '.'

check_links:
name: Check links in markdown files
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Check links in markdown files (markdown-link-check)
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'no'
config-file: '.markdown-link-check-config.json'

precommit:
name: pre-commit checks
runs-on: ubuntu-latest
steps:
- 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
8 changes: 4 additions & 4 deletions .github/workflows/run-domain-decomposition-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:
pull_request:
branches:
- "*"
jobs:
jobs:
domain_decomposition_integration_tests:
name: Run domain decomposition integration tests
runs-on: ubuntu-latest
container: precice/precice:nightly
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: micro-manager

Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
timeout-minutes: 3
working-directory: micro-manager/tests/integration/test_unit_cube
run: mpiexec -n 2 --allow-run-as-root python3 run_micro_manager.py --config micro-manager-config-parallel-1.json & python3 unit_cube.py

- name: Run integration test (variant 2)
timeout-minutes: 3
working-directory: micro-manager/tests/integration/test_unit_cube
Expand All @@ -54,7 +54,7 @@ jobs:
container: precice/precice:nightly
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: micro-manager

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-macro-micro-dummy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:
pull_request:
branches:
- "*"
jobs:
jobs:
run_dummy:
name: Run dummy
runs-on: ubuntu-latest
container: precice/precice:nightly
steps:

- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: micro-manager

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
container: precice/precice:nightly
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: micro-manager

Expand Down
9 changes: 7 additions & 2 deletions .markdown-link-check-config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"aliveStatusCodes": [429, 200]
}
"aliveStatusCodes": [429, 200],
"ignorePatterns": [
{
"pattern": "*.html"
}
]
}
10 changes: 6 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ repos:
rev: 22.12.0
hooks:
- id: black
# isort for python imports
- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/precice/precice-pre-commit-hooks
rev: 'v3.3'
hooks:
- id: isort
- id: format-precice-config
files: "^.*/precice-config.xml"
- id: check-image-prefix
args: [ --prefix=docs-tooling-micro-manager- ]
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ summary: A tool to manage many micro simulations and couple them to a macro simu

The Micro Manager manages many simulations on a micro scale and couples them to one simulation on a macro scale. For the coupling itself, it heavily relies on the coupling library [preCICE](https://precice.org/index.html).

![Micro Manager strategy schematic](images/tooling-micro-manager-manager-solution.png)
![Micro Manager strategy schematic](images/docs-tooling-micro-manager-manager-solution.png)

## What can it do?

Expand Down
2 changes: 1 addition & 1 deletion examples/cpp-dummy/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ precice-run/
__pycache__

# Compiled files
*.so
*.so
7 changes: 5 additions & 2 deletions examples/cpp-dummy/run_micro_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
Script to run the Micro Manager
"""

from micro_manager import MicroManager
from argparse import ArgumentParser

from micro_manager import MicroManager

parser = ArgumentParser()
parser.add_argument("--config", required=True, help="Path to the micro manager configuration file")
parser.add_argument(
"--config", required=True, help="Path to the micro manager configuration file"
)
args = parser.parse_args()

manager = MicroManager(args.config)
Expand Down
38 changes: 28 additions & 10 deletions examples/macro_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,27 @@ def main():
vertex_ids = interface.set_mesh_vertices(read_mesh_name, coords)

write_scalar_data = np.zeros(nv)
write_vector_data = np.zeros((nv, interface.get_data_dimensions(write_mesh_name, "macro-vector-data")))
write_vector_data = np.zeros(
(nv, interface.get_data_dimensions(write_mesh_name, "macro-vector-data"))
)

for i in range(nv):
write_scalar_data[i] = i
for d in range(interface.get_data_dimensions(write_mesh_name, "macro-vector-data")):
for d in range(
interface.get_data_dimensions(write_mesh_name, "macro-vector-data")
):
write_vector_data[i, d] = i

if interface.requires_initial_data():
for name, dim in write_data_names.items():
if dim == 0:
interface.write_data(write_mesh_name, name, vertex_ids, write_scalar_data)
interface.write_data(
write_mesh_name, name, vertex_ids, write_scalar_data
)
elif dim == 1:
interface.write_data(write_mesh_name, name, vertex_ids, write_vector_data)
interface.write_data(
write_mesh_name, name, vertex_ids, write_vector_data
)

# initialize preCICE
interface.initialize()
Expand All @@ -61,13 +69,19 @@ def main():

for name, dim in read_data_names.items():
if dim == 0:
read_scalar_data = interface.read_data(read_mesh_name, name, vertex_ids, 1)
read_scalar_data = interface.read_data(
read_mesh_name, name, vertex_ids, 1
)
elif dim == 1:
read_vector_data = interface.read_data(read_mesh_name, name, vertex_ids, 1)
read_vector_data = interface.read_data(
read_mesh_name, name, vertex_ids, 1
)

write_scalar_data[:] = read_scalar_data[:]
for i in range(nv):
for d in range(interface.get_data_dimensions(read_mesh_name, "micro-vector-data")):
for d in range(
interface.get_data_dimensions(read_mesh_name, "micro-vector-data")
):
write_vector_data[i, d] = read_vector_data[i, d]
if t > 1: # to trigger adaptivity after some time
# ensure that the data is different from the previous time step
Expand All @@ -76,9 +90,13 @@ def main():

for name, dim in write_data_names.items():
if dim == 0:
interface.write_data(write_mesh_name, name, vertex_ids, write_scalar_data)
interface.write_data(
write_mesh_name, name, vertex_ids, write_scalar_data
)
elif dim == 1:
interface.write_data(write_mesh_name, name, vertex_ids, write_vector_data)
interface.write_data(
write_mesh_name, name, vertex_ids, write_vector_data
)

# do the coupling
interface.advance(dt)
Expand All @@ -96,5 +114,5 @@ def main():
interface.finalize()


if __name__ == '__main__':
if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion examples/precice-config-adaptivity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<log>
<sink type="stream" output="stdout" filter= "%Severity% > debug" enabled="true" />
</log>

<data:scalar name="macro-scalar-data"/>
<data:vector name="macro-vector-data"/>
<data:scalar name="micro-scalar-data"/>
Expand Down
Loading

0 comments on commit 1801c0b

Please sign in to comment.