Skip to content

Commit 1bb7470

Browse files
authored
Merge pull request #60 from DataAnalyticsEngineering/FANS-v0.4.0
Release v0.4.0
2 parents 158ddd1 + 055e4c7 commit 1bb7470

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+7053
-323
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
# Check for updates to GitHub Actions every week
12+
interval: "weekly"

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!-- Add a short description of your contribution here. Skip this if the title is self-explanatory -->
2+
3+
Checklist:
4+
5+
- [ ] I made sure that the CI passed before I ask for a review.
6+
- [ ] I added a summary of the changes (compared to the last release) in the `CHANGELOG.md`.
7+
- [ ] If necessary, I made changes to the documentation and/or added new content.
8+
- [ ] I will remember to squash-and-merge, providing a useful summary of the changes of this PR.

.github/workflows/build_and_test.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
UBUNTU_VERSION: [noble, jammy, focal]
30+
UBUNTU_VERSION: [noble, jammy]
3131
steps:
3232
- name: Checkout code
3333
uses: actions/checkout@v4
3434

35+
- name: Set up pixi
36+
uses: prefix-dev/setup-pixi@v0.8.8
37+
3538
- name: Generate build directory
3639
run: mkdir -p ${{ env.FANS_BUILD_DIR }}
3740

@@ -67,10 +70,30 @@ jobs:
6770

6871
- name: Tests
6972
working-directory: ${{ env.FANS_BUILD_DIR }}
70-
run: su -c "ctest" ${{ env.FANS_MPI_USER }}
73+
run: |
74+
su -c "ctest" ${{ env.FANS_MPI_USER }}
7175
7276
- uses: actions/upload-artifact@v4
7377
if: failure()
7478
with:
7579
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CTest logs
7680
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log
81+
82+
# ────────────────────────────────────────────────────────────────
83+
# Pytest checks
84+
# ────────────────────────────────────────────────────────────────
85+
- name: Install Pixi Python deps
86+
run: |
87+
pixi --version
88+
pixi install
89+
90+
- name: Run pytest checks on HDF5 output
91+
run: pixi run test
92+
93+
- uses: actions/upload-artifact@v4
94+
if: failure()
95+
with:
96+
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} PyTest logs
97+
path: |
98+
**/pytest*.xml
99+
**/.pytest_cache
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Build and test macOS 15
2+
# Builds FANS for macOS 15 on Apple Silicon CPU and runs the tests.
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- develop
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{github.event_name == 'pull_request'}}
15+
16+
jobs:
17+
build-macos:
18+
name: macOS 15
19+
runs-on: macos-15
20+
env:
21+
FANS_BUILD_DIR: build
22+
strategy:
23+
fail-fast: false
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Install FANS dependencies
29+
run: |
30+
brew install gnu-time cmake gcc@14
31+
brew install open-mpi --build-from-source --cc=gcc-14
32+
brew install hdf5-mpi --build-from-source --cc=gcc-14
33+
brew install fftw eigen
34+
35+
- name: Set up pixi
36+
uses: prefix-dev/setup-pixi@v0.8.8
37+
38+
- name: Generate build directory
39+
run: mkdir -p ${{ env.FANS_BUILD_DIR }}
40+
41+
- name: Configure
42+
working-directory: ${{ env.FANS_BUILD_DIR }}
43+
env:
44+
CC: gcc-14
45+
CXX: g++-14
46+
MPICC: mpicc
47+
MPICXX: mpicxx
48+
run: |
49+
cmake --version
50+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
51+
52+
- uses: actions/upload-artifact@v4
53+
if: failure()
54+
with:
55+
name: macOS 15 CMakeCache
56+
path: ${{ env.FANS_BUILD_DIR }}/CMakeCache.txt
57+
- uses: actions/upload-artifact@v4
58+
if: failure()
59+
with:
60+
name: macOS 15 CMakeLogs
61+
path: '${{ env.FANS_BUILD_DIR }}/CMakeFiles/*.log'
62+
- uses: actions/upload-artifact@v4
63+
if: failure()
64+
with:
65+
name: macOS 15 CompileCommands
66+
path: ${{ env.FANS_BUILD_DIR }}/compile_commands.json
67+
68+
- name: Compile
69+
working-directory: ${{ env.FANS_BUILD_DIR }}
70+
run:
71+
cmake --build . -j $(nproc) || cmake --build . -j1
72+
73+
- name: Tests
74+
working-directory: ${{ env.FANS_BUILD_DIR }}
75+
env:
76+
CTEST_OUTPUT_ON_FAILURE: 1
77+
run: ctest
78+
79+
- uses: actions/upload-artifact@v4
80+
if: failure()
81+
with:
82+
name: macOS 15 CTest logs
83+
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log
84+
85+
# ────────────────────────────────────────────────────────────────
86+
# Pytest checks
87+
# ────────────────────────────────────────────────────────────────
88+
- name: Install Pixi Python deps
89+
run: |
90+
pixi --version
91+
pixi install
92+
93+
- name: Run pytest checks on HDF5 output
94+
run: pixi run test
95+
96+
- uses: actions/upload-artifact@v4
97+
if: failure()
98+
with:
99+
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} PyTest logs
100+
path: |
101+
**/pytest*.xml
102+
**/.pytest_cache

.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
build-and-push:
77
strategy:
88
matrix:
9-
ubuntu-version: [noble, jammy, focal]
9+
ubuntu-version: [noble, jammy]
1010

1111
runs-on: ubuntu-latest
1212

.github/workflows/test_pyfans.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Test PyFans
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- "*"
11+
12+
jobs:
13+
test-pyfans:
14+
runs-on: ubuntu-latest
15+
container: unistuttgartdae/fans-ci:noble
16+
defaults:
17+
run:
18+
shell: "bash --login -eo pipefail {0}"
19+
env:
20+
FANS_BUILD_DIR: build
21+
FANS_MPI_USER: fans
22+
steps:
23+
24+
- name: Checkout repository
25+
uses: actions/checkout@v2
26+
27+
- name: Generate build directory
28+
run: mkdir -p ${{ env.FANS_BUILD_DIR }}
29+
30+
- name: Install dependencies
31+
run: |
32+
apt update
33+
apt install -y wget python3-venv
34+
35+
- name: Install preCICE
36+
run: |
37+
wget https://github.com/precice/precice/releases/download/v3.2.0/libprecice3_3.2.0_noble.deb
38+
apt install -y ./libprecice3_3.2.0_noble.deb
39+
40+
- name: Install the Micro Manager
41+
run: |
42+
python3 -m venv .venv
43+
. .venv/bin/activate
44+
pip install micro-manager-precice
45+
46+
- name: Configure
47+
working-directory: ${{ env.FANS_BUILD_DIR }}
48+
run: |
49+
cmake .. -DFANS_LIBRARY_FOR_MICRO_MANAGER=ON
50+
make
51+
52+
- name: Run a dummy macro-micro coupling test
53+
run: |
54+
. .venv/bin/activate
55+
cd test/test_pyfans
56+
python3 macro-cube.py & micro-manager-precice micro-manager-config.json

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,15 @@ test/input_files/**/*.json
198198
**/scratch/
199199

200200
# Test microstructure files
201-
!sphere.h5
201+
!sphere32.h5
202202

203203
# Test input files
204204
!test_LinearElastic.json
205205
!test_LinearThermal.json
206206
!test_PseudoPlastic.json
207207
!test_J2Plasticity.json
208+
!test_MixedBCs.json
209+
210+
# pixi environments
211+
.pixi
212+
*.egg-info

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# FANS Changelog
22

3+
## v0.4.0
4+
5+
- Support compilaion on MacOS X via conda-forge https://github.com/DataAnalyticsEngineering/FANS/pull/59
6+
- Add support for macroscale mixed stress-strain boundary conditions https://github.com/DataAnalyticsEngineering/FANS/pull/58
7+
- Add grain boundary diffusion material model for polycrystals https://github.com/DataAnalyticsEngineering/FANS/pull/52
8+
- Add a pixi environment for the FANS_dashboard and some tests https://github.com/DataAnalyticsEngineering/FANS/pull/55
9+
- Remove MPI initialization from pyFANS and add an integration test for it https://github.com/DataAnalyticsEngineering/FANS/pull/46
10+
- Native support for MacOS https://github.com/DataAnalyticsEngineering/FANS/pull/25
11+
- Remove Ubuntu 20.04 from testing and Docker support https://github.com/DataAnalyticsEngineering/FANS/pull/51
12+
- Add support for `--version` command line argument for checking the version of FANS
13+
- Modify way to provide micro structure in JSON input https://github.com/DataAnalyticsEngineering/FANS/pull/43
14+
- Add conda package for FANS https://github.com/DataAnalyticsEngineering/FANS/pull/39
15+
- Introduce system for checking compiler flags: `avx2` & `fma` https://github.com/DataAnalyticsEngineering/FANS/pull/34
16+
- Add `results_prefix` field in the JSON input https://github.com/DataAnalyticsEngineering/FANS/pull/36
17+
- Build FANS as a library to be coupled to a macro-scale simulation via preCICE and the Micro Manager https://github.com/DataAnalyticsEngineering/FANS/pull/23
18+
319
## v0.3.0
420

521
- Added Linear thermal and mechanical triclinic material models https://github.com/DataAnalyticsEngineering/FANS/pull/32

CMakeLists.txt

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
cmake_minimum_required(VERSION 3.0...3.28)
1+
cmake_minimum_required(VERSION 3.21)
22

33
# ##############################################################################
44
# GENERAL SETTINGS
55
# ##############################################################################
66

77
project(FANS
8-
VERSION 0.3.0
8+
VERSION 0.4.0
99
LANGUAGES C CXX
1010
)
1111

@@ -17,7 +17,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
1717

1818
# with -fno-implicit-templates I get linker errors when using std:: stuff
1919
# TODO: should be developer specific, by using e.g. CMake Presets
20-
set(CMAKE_CXX_FLAGS "-fmax-errors=1 -O3")
20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
2121
set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
2222

2323
# IPO
@@ -54,9 +54,12 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
5454
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
5555

5656
# From https://stackoverflow.com/questions/73248130/how-to-avoid-the-removal-of-the-rpath-during-cmake-install-step
57-
5857
# Set RPATH to be relative and honor user overrides, whether at the command line or FetchContent
59-
set(RPATH_BASE "$ORIGIN")
58+
if(APPLE)
59+
set(RPATH_BASE "@loader_path")
60+
else()
61+
set(RPATH_BASE "$ORIGIN")
62+
endif()
6063
file(RELATIVE_PATH REL_PATH_LIB
6164
"/${CMAKE_INSTALL_BINDIR}/"
6265
"/${CMAKE_INSTALL_LIBDIR}/")
@@ -81,12 +84,21 @@ find_package(HDF5 REQUIRED COMPONENTS CXX)
8184

8285
find_package(Eigen3 REQUIRED)
8386

84-
find_package(OpenMP REQUIRED)
85-
8687
find_package(MPI REQUIRED)
8788

8889
find_package(FFTW3 REQUIRED COMPONENTS DOUBLE MPI)
8990

91+
option(FANS_LIBRARY_FOR_MICRO_MANAGER "Building FANS as a library to be used by the Micro Manager." OFF)
92+
93+
if (FANS_LIBRARY_FOR_MICRO_MANAGER)
94+
include(FetchContent)
95+
FetchContent_Declare(
96+
pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11.git
97+
GIT_TAG v2.12.0
98+
)
99+
FetchContent_MakeAvailable(pybind11)
100+
endif()
101+
90102
# ##############################################################################
91103
# TARGETS
92104
# ##############################################################################
@@ -100,7 +112,7 @@ endif ()
100112
add_library(FANS::FANS ALIAS FANS_FANS)
101113

102114
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")
103-
target_compile_options(FANS_FANS PUBLIC -march=armv8-a+simd+fp+crypto)
115+
104116
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
105117
target_compile_options(FANS_FANS PUBLIC -mavx2 -mfma)
106118
endif ()
@@ -115,6 +127,10 @@ add_custom_command(
115127
COMMENT "Create a symlink for FANS executable to ${CMAKE_CURRENT_SOURCE_DIR}/test/"
116128
)
117129

130+
if (FANS_LIBRARY_FOR_MICRO_MANAGER)
131+
add_subdirectory(pyfans)
132+
endif ()
133+
118134
# ##############################################################################
119135
# HEADERS
120136
# ##############################################################################
@@ -132,13 +148,23 @@ set_property(TARGET FANS_FANS PROPERTY PUBLIC_HEADER
132148
include/solverFP.h
133149
include/solver.h
134150
include/setup.h
151+
include/mixedBCs.h
135152

136153
include/material_models/LinearThermal.h
154+
include/material_models/GBDiffusion.h
155+
137156
include/material_models/LinearElastic.h
138157
include/material_models/PseudoPlastic.h
139158
include/material_models/J2Plasticity.h
140159
)
141160

161+
# version.h is generated and added to the build include directory
162+
configure_file(
163+
"${PROJECT_SOURCE_DIR}/include/version.h.in"
164+
"${PROJECT_BINARY_DIR}/include/version.h" @ONLY
165+
)
166+
target_include_directories(FANS_main PRIVATE "${PROJECT_BINARY_DIR}/include")
167+
142168
# ##############################################################################
143169
# SOURCES
144170
# ##############################################################################
@@ -175,9 +201,6 @@ target_compile_definitions(FANS_FANS PUBLIC ${FFTW3_DEFINITIONS})
175201

176202
target_link_libraries(FANS_FANS PUBLIC Eigen3::Eigen)
177203

178-
target_link_libraries(FANS_FANS PUBLIC OpenMP::OpenMP_CXX)
179-
180-
181204
target_link_libraries(FANS_main PRIVATE FANS::FANS)
182205

183206
# ##############################################################################

0 commit comments

Comments
 (0)