Skip to content

Commit

Permalink
Merge pull request #24 from DataAnalyticsEngineering/FANS-v0.2.0
Browse files Browse the repository at this point in the history
Release v0.2.0
  • Loading branch information
IshaanDesai authored Sep 22, 2024
2 parents 54ee6d2 + 5ba3637 commit 077addf
Show file tree
Hide file tree
Showing 26 changed files with 883 additions and 474 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/build.sh

This file was deleted.

59 changes: 0 additions & 59 deletions .github/workflows/build_and_package.yaml

This file was deleted.

76 changes: 76 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build and Test
# Builds FANS inside various docker containers and runs the tests.

on:
push:
branches:
- main
- develop
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{github.event_name == 'pull_request'}}

jobs:
build:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }}
runs-on: ubuntu-latest
container: unistuttgartdae/fans-ci:${{ matrix.UBUNTU_VERSION }}
defaults:
run:
shell: "bash --login -eo pipefail {0}"
env:
FANS_BUILD_DIR: build
FANS_MPI_USER: fans
strategy:
fail-fast: false
matrix:
UBUNTU_VERSION: [noble, jammy, focal]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate build directory
run: mkdir -p ${{ env.FANS_BUILD_DIR }}

- name: Configure
working-directory: ${{ env.FANS_BUILD_DIR }}
run: |
cmake --version
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CMakeCache
path: ${{ env.FANS_BUILD_DIR }}/CMakeCache.txt
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CMakeLogs
path: '${{ env.FANS_BUILD_DIR }}/CMakeFiles/*.log'
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CompileCommands
path: ${{ env.FANS_BUILD_DIR }}/compile_commands.json

- name: Compile
working-directory: ${{ env.FANS_BUILD_DIR }}
run:
cmake --build . -j $(nproc) || cmake --build . -j1

- name: Adjust user rights
run: chown -R ${{ env.FANS_MPI_USER }} ${{ env.FANS_BUILD_DIR }}

- name: Tests
working-directory: ${{ env.FANS_BUILD_DIR }}
run: su -c "ctest" ${{ env.FANS_MPI_USER }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CTest logs
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ test/input_files/**/*.json
!sphere.h5

# Test input files
!test_LinearElasticIsotropic.json
!test_LinearThermalIsotropic.json
!test_PseudoPlasticLinearHardening.json
!test_VonMisesPlasticLinearIsotropicHardening.json
!test_LinearElastic.json
!test_LinearThermal.json
!test_PseudoPlastic.json
!test_J2Plasticity.json
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ repos:
rev: 22.12.0
hooks:
- id: black
# clang-format for C/C++ formatting
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v8.0.1
hooks:
- id: clang-format
args: ['--style=file']
exclude: "include/json.hpp"
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# FANS Changelog

## v0.2.0

- Add integration tests https://github.com/DataAnalyticsEngineering/FANS/pull/20
- Add GitHub Action workflow to build and test FANS https://github.com/DataAnalyticsEngineering/FANS/pull/19

## v0.1.2

- Update TIK GitHub links in the documentation to public GitHub links https://github.com/DataAnalyticsEngineering/FANS/pull/13
Expand Down
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.0...3.28)
# ##############################################################################

project(FANS
VERSION 0.1.2
VERSION 0.2.0
LANGUAGES C CXX
)

Expand Down Expand Up @@ -135,8 +135,8 @@ set_property(TARGET FANS_FANS PROPERTY PUBLIC_HEADER

include/material_models/LinearThermalIsotropic.h
include/material_models/LinearElasticIsotropic.h
include/material_models/PseudoPlasticLinearHardening.h
include/material_models/VonMisesPlasticLinearIsotropicHardening.h
include/material_models/PseudoPlastic.h
include/material_models/J2Plasticity.h
)

# ##############################################################################
Expand Down Expand Up @@ -251,6 +251,19 @@ install(
COMPONENT FANS_Development
)

# ##############################################################################
# TESTING
# ##############################################################################

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(FANS_ENABLE_TESTING_DEFAULT ON)
endif ()
option(FANS_ENABLE_TESTING "Enable testing" ${FANS_ENABLE_TESTING_DEFAULT})
if (FANS_ENABLE_TESTING)
enable_testing()
add_subdirectory(test)
endif ()

# ##############################################################################
# PACKAGING
# ##############################################################################
Expand Down
18 changes: 9 additions & 9 deletions FANS_Dashboard/FANS_Dashboard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
"outputs": [],
"source": [
"# Specify which microstructures, load cases, and quantities to load\n",
"microstructures_to_load = ['/sphere/32x32x32/ms']\n",
"load_cases_to_load = ['load0']\n",
"microstructures_to_load = list(hierarchy.keys())\n",
"load_cases_to_load = list(hierarchy[microstructures_to_load[0]].keys())\n",
"quantities_to_load = ['strain_average', 'stress_average', 'phase_stress_average_phase0', \"stress\"]\n",
"time_steps_to_load = []\n",
"\n",
Expand All @@ -143,7 +143,11 @@
" quantities_to_load, \n",
" microstructures_to_load, \n",
" load_cases_to_load, \n",
" time_steps_to_load)"
" time_steps_to_load)\n",
"\n",
"strain_average = data[microstructures_to_load[0]][load_cases_to_load[0]]['strain_average'] \n",
"stress_average = data[microstructures_to_load[0]][load_cases_to_load[0]]['stress_average']\n",
"time_steps = data[microstructures_to_load[0]][load_cases_to_load[0]]['time_steps']\n"
]
},
{
Expand All @@ -164,10 +168,6 @@
"metadata": {},
"outputs": [],
"source": [
"strain_average = data['/sphere/32x32x32/ms']['load0']['strain_average']\n",
"stress_average = data['/sphere/32x32x32/ms']['load0']['stress_average']\n",
"time_steps = data['/sphere/32x32x32/ms']['load0']['time_steps']\n",
"\n",
"# Specify measures to compute\n",
"measures_to_compute = ['von_mises', 'hydrostatic', 'deviatoric', 'principal', \n",
" 'max_shear', 'I_invariants', 'J_invariants', 'eigenvalues',\n",
Expand Down Expand Up @@ -209,8 +209,8 @@
"# Postprocessing and writing to h5 file\n",
"quantities_to_postprocess = ['stress_average', 'stress']\n",
"measures_to_postprocess = ['deviatoric', 'von_mises']\n",
"microstructures_to_postprocess = ['/sphere/32x32x32/ms']\n",
"load_cases_to_postprocess = ['load0']\n",
"microstructures_to_postprocess = microstructures_to_load[0]\n",
"load_cases_to_postprocess = load_cases_to_load[0]\n",
"\n",
"processed_data = postprocess_and_write_to_h5(file_path, hierarchy, quantities_to_postprocess, measures_to_postprocess, \n",
" microstructures_to_postprocess, load_cases_to_postprocess)"
Expand Down
Loading

0 comments on commit 077addf

Please sign in to comment.