diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..3868c2e
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,119 @@
+---
+Language: Cpp
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: true
+AlignConsecutiveDeclarations: true
+AlignEscapedNewlines: Right
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: MultiLine
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeBlocks: Preserve
+IncludeCategories:
+ - Regex: '^(<|"(gtest|isl|json)/)'
+ Priority: 1
+ - Regex: '.*'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 1
+IncludeIsMainRegex: '$'
+IndentCaseLabels: false
+IndentPPDirectives: None
+IndentWidth: 4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 4
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 100
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: true
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+StatementMacros:
+ - Q_UNUSED
+ - QT_REQUIRE_VERSION
+TabWidth: 4
+UseTab: Never
+...
diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml
new file mode 100644
index 0000000..fd6d7dd
--- /dev/null
+++ b/.github/workflows/clang-format-check.yml
@@ -0,0 +1,21 @@
+name: clang-format Check
+on:
+ push:
+ branches:
+ - main
+ - develop
+ pull_request:
+
+jobs:
+ formatting-check:
+ name: Formatting Check
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Run clang-format style check for C/C++/Protobuf programs.
+ uses: jidicula/clang-format-action@v4.13.0
+ with:
+ clang-format-version: '13'
+ check-path: ${{ matrix.path }}
+ exclude-regex: 'include/json.hpp'
+ fallback-style: 'Mozilla' # optional
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 00ca4e2..963aebf 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,4 +1,6 @@
repos:
+# Official repo for the clang-format hook
+repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..b166451
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,6 @@
+# FANS Changelog
+
+## v0.1.0
+
+- Add release guide and a Changelog file https://github.com/DataAnalyticsEngineering/FANS/pull/4
+- Add clang-format check and format all relevant files https://github.com/DataAnalyticsEngineering/FANS/pull/1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1041009..b299b6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.0...3.28)
# ##############################################################################
project(FANS
- VERSION 0.0.0
+ VERSION 0.1.0
LANGUAGES C CXX
)
diff --git a/FANS_Dashboard/FANS_Dashboard.ipynb b/FANS_Dashboard/FANS_Dashboard.ipynb
index 86a3d55..619303a 100644
--- a/FANS_Dashboard/FANS_Dashboard.ipynb
+++ b/FANS_Dashboard/FANS_Dashboard.ipynb
@@ -32,7 +32,7 @@
"- `collections`\n",
"- `argparse`\n",
"- `lxml`\n",
- "- `re`",
+ "- `re`\n",
"- `nbformat`"
]
},
@@ -232,11 +232,11 @@
"outputs": [],
"source": [
"# Plot stress average vs strain average for each component\n",
- "\n",
- "plot_subplots(strain_average, stress_average, labels_x=['Strain']*6, labels_y=['Stress']*6, \n",
- " subplot_titles=['component - 11', 'component - 22', 'component - 33', 'component - 12', 'component - 13', 'component - 23'], \n",
- " title='Stress average vs strain average', \n",
- " nrows=2, ncols=3, linewidth=1, markersize=4, linecolor='blue', markercolor='blue', fontsize=12)\n"
+ "fig = plot_subplots(strain_average, stress_average, labels_x=['Strain']*6, labels_y=['Stress']*6, \n",
+ " subplot_titles=['component - 11', 'component - 22', 'component - 33', 'component - 12', 'component - 13', 'component - 23'], \n",
+ " title='Stress average vs strain average', \n",
+ " nrows=2, ncols=3, linewidth=1, markersize=4, linecolor=[\"blue\"]*6, markercolor=[\"blue\"]*6, fontsize=16)\n",
+ "fig.show()"
]
},
{
@@ -246,10 +246,11 @@
"outputs": [],
"source": [
"# Plot deviatoric stress average vs strain average for each component\n",
- "plot_subplots(strain_average, stress_average_deviatoric, labels_x=['Strain']*6, labels_y=['Stress_dev']*6,\n",
- " subplot_titles=['component - 11', 'component - 22', 'component - 33', 'component - 12', 'component - 13', 'component - 23'],\n",
- " title='Deviatoric stress average vs strain average',\n",
- " nrows=2, ncols=3, linewidth=1, markersize=4, linecolor='blue', markercolor='blue', fontsize=12)"
+ "fig = plot_subplots(strain_average, stress_average_deviatoric, labels_x=['Strain']*6, labels_y=['Stress_dev']*6,\n",
+ " subplot_titles=['component - 11', 'component - 22', 'component - 33', 'component - 12', 'component - 13', 'component - 23'],\n",
+ " title='Deviatoric stress average vs strain average',\n",
+ " nrows=2, ncols=3, linewidth=1, markersize=4, linecolor=[\"blue\"]*6, markercolor=[\"blue\"]*6, fontsize=16)\n",
+ "fig.show()"
]
},
{
@@ -260,10 +261,11 @@
"source": [
"# Plot deviatoric stress average vs time\n",
"time_broadcasted = np.tile(time_steps[:, np.newaxis], (1, stress_average.shape[1]))\n",
- "plot_subplots(time_broadcasted, stress_average_deviatoric, labels_x=['Time']*6, labels_y=['Stress_dev']*6,\n",
- " subplot_titles=['component - 11', 'component - 22', 'component - 33', 'component - 12', 'component - 13', 'component - 23'],\n",
- " title='Deviatoric stress average vs time',\n",
- " nrows=2, ncols=3, linewidth=1, markersize=4, linecolor='blue', markercolor='blue', fontsize=12)\n"
+ "fig = plot_subplots(time_broadcasted, stress_average_deviatoric, labels_x=['Time']*6, labels_y=['Stress_dev']*6,\n",
+ " subplot_titles=['component - 11', 'component - 22', 'component - 33', 'component - 12', 'component - 13', 'component - 23'],\n",
+ " title='Deviatoric stress average vs time',\n",
+ " nrows=2, ncols=3, linewidth=1, markersize=4, linecolor=[\"blue\"]*6, markercolor=[\"blue\"]*6, fontsize=16)\n",
+ "fig.show()"
]
},
{
@@ -272,12 +274,12 @@
"metadata": {},
"outputs": [],
"source": [
- "plot_subplots(\n",
- " np.column_stack((strain_average[:, 0], strain_average[:, 0])), \n",
- " np.column_stack((stress_average[:, 0], stress_average_deviatoric[:, 0])), \n",
- " labels_x=['Strain_11']*2, labels_y=['Stress_11', 'Stress_dev_11'],\n",
- " subplot_titles=['Stress_11 vs Strain_11', 'Stress_dev_11 vs Strain_11'],\n",
- " nrows=1, ncols=2, linewidth=1, markersize=4, linecolor='blue', markercolor='blue', fontsize=12)"
+ "fig = plot_subplots(np.column_stack((strain_average[:, 0], strain_average[:, 0])), \n",
+ " np.column_stack((stress_average[:, 0], stress_average_deviatoric[:, 0])), \n",
+ " labels_x=['Strain_11']*2, labels_y=['Stress_11', 'Stress_dev_11'],\n",
+ " subplot_titles=['Stress_11 vs Strain_11', 'Stress_dev_11 vs Strain_11'],\n",
+ " nrows=1, ncols=2, linewidth=1, markersize=4, linecolor=[\"blue\"]*2, markercolor=[\"blue\"]*2, fontsize=16)\n",
+ "fig.show()"
]
},
{
@@ -335,7 +337,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.4"
+ "version": "3.12.0"
}
},
"nbformat": 4,
diff --git a/FANS_Dashboard/README.md b/FANS_Dashboard/README.md
index 1c52fde..2704fcc 100644
--- a/FANS_Dashboard/README.md
+++ b/FANS_Dashboard/README.md
@@ -1,5 +1,5 @@
# FANS Dashboard
-This folder contains a Jupyter Notebook designed to post-process, interpret, and visualize results generated by FANS. The notebook provides tools for exploring the hierarchical structure of HDF5 files, extracting and summarizing simulation data, and preparing the results for visualization in ParaView.
+The FANS Dashboard is a comprehensive tool designed to streamline the post-processing, interpretation, and visualization of results generated by the FANS solver. This jupyter notebook provides a user-friendly environment to work with complex simulation data stored in HDF5 format, offering a step-by-step workflow that covers data extraction, postprocessing, visualization, and preparation for 3D visualization in tools like ParaView.
-For further details follow along `FANS_Dashboard.ipynb`
+For further details follow along [`FANS_Dashboard.ipynb`](FANS_Dashboard.ipynb)
diff --git a/FANS_Dashboard/plotting.py b/FANS_Dashboard/plotting.py
index ae1af0d..840738e 100644
--- a/FANS_Dashboard/plotting.py
+++ b/FANS_Dashboard/plotting.py
@@ -9,14 +9,15 @@ def plot_subplots(
labels_x=None,
labels_y=None,
subplot_titles=None,
- title="Subplot Grid",
+ title="",
nrows=None,
ncols=None,
linewidth=1,
markersize=4,
- linecolor="blue",
- markercolor="red",
+ linecolor=None,
+ markercolor=None,
fontsize=12,
+ fig=None,
):
"""
Plot a grid of subplots using Plotly, handling both single-component (scalar vs scalar) and multi-component data.
@@ -32,9 +33,10 @@ def plot_subplots(
- ncols: int, number of columns in the subplot grid (optional)
- linewidth: int, line width for the plots (optional, default=1)
- markersize: int, size of the markers (optional, default=4)
- - linecolor: string, color of the lines (optional, default="blue")
- - markercolor: string, color of the markers (optional, default="red")
+ - linecolor: list of strings, colors of the lines for each subplot (optional, default=None, all blue)
+ - markercolor: list of strings, colors of the markers for each subplot (optional, default=None, all blue)
- fontsize: int, font size for axis labels, subplot titles, and tick labels (optional, default=12)
+ - fig: existing Plotly figure to overlay the new subplots (optional, default=None, creates a new figure)
"""
# Validate data shapes
if not isinstance(data1, np.ndarray) or not isinstance(data2, np.ndarray):
@@ -53,6 +55,21 @@ def plot_subplots(
# Set the number of components based on data shape
n_components = data1.shape[1]
+ # Initialize linecolor and markercolor lists if not provided
+ if linecolor is None:
+ linecolor = ["blue"] * n_components
+ elif len(linecolor) != n_components:
+ raise ValueError(
+ f"The length of linecolor must match the number of components ({n_components})."
+ )
+
+ if markercolor is None:
+ markercolor = ["blue"] * n_components
+ elif len(markercolor) != n_components:
+ raise ValueError(
+ f"The length of markercolor must match the number of components ({n_components})."
+ )
+
# If nrows or ncols is not specified, determine an optimal grid layout
if nrows is None or ncols is None:
nrows = int(np.ceil(np.sqrt(n_components)))
@@ -81,8 +98,9 @@ def plot_subplots(
f"The length of labels_y must match the number of components ({n_components})."
)
- # Create the subplot figure
- fig = make_subplots(rows=nrows, cols=ncols, subplot_titles=subplot_titles)
+ # Create the subplot figure if not provided
+ if fig is None:
+ fig = make_subplots(rows=nrows, cols=ncols, subplot_titles=subplot_titles)
# Add traces for each component
for i in range(n_components):
@@ -93,8 +111,8 @@ def plot_subplots(
x=data1[:, i],
y=data2[:, i],
mode="lines+markers",
- marker=dict(symbol="x", size=markersize, color=markercolor),
- line=dict(width=linewidth, color=linecolor),
+ marker=dict(symbol="x", size=markersize, color=markercolor[i]),
+ line=dict(width=linewidth, color=linecolor[i]),
name=f"Component {i+1}",
),
row=row,
@@ -113,6 +131,7 @@ def plot_subplots(
ticklen=6,
title_font=dict(size=fontsize),
tickfont=dict(size=fontsize),
+ automargin=True,
)
fig.update_yaxes(
title_text=labels_y[i],
@@ -125,17 +144,18 @@ def plot_subplots(
ticklen=6,
title_font=dict(size=fontsize),
tickfont=dict(size=fontsize),
+ automargin=True,
)
# Update layout with the overall plot title and styling
fig.update_layout(
- height=600,
- width=900,
+ height=1000,
+ width=1600,
title_text=title,
title_font=dict(size=fontsize),
- showlegend=False,
+ showlegend=False, # Legends removed
template="plotly_white",
- margin=dict(l=20, r=20, t=50, b=20),
+ margin=dict(l=50, r=50, t=50, b=50), # Adjust margins to prevent overlap
title_x=0.5,
autosize=False,
)
@@ -161,12 +181,5 @@ def plot_subplots(
for annotation in fig["layout"]["annotations"]:
annotation["font"] = dict(size=fontsize)
- # Increase the DPI/quality of the plots by setting higher resolution dimensions
- fig.update_layout(
- height=1200,
- width=1800,
- autosize=False,
- )
-
- # Show the plot
- fig.show()
+ # Return the figure for further customization or overlaying
+ return fig
diff --git a/README.md b/README.md
index 1197506..59163c2 100644
--- a/README.md
+++ b/README.md
@@ -2,14 +2,14 @@
Fourier Accelerated Nodal Solvers (FANS) is an FFT-based homogenization solver designed to handle microscale multiphysics problems. This repository contains a C++ implementation of FANS, built using CMake and MPI for parallel computations.
-
+
## Table of Contents
- [Installation](#installation)
-- [Usage](#usage)
- [Input File Format](#input-file-format)
-- [Example](#example)
+- [Examples](#examples)
+- [Acknowledgements](#acknowledgements)
## Installation
@@ -17,6 +17,32 @@ Fourier Accelerated Nodal Solvers (FANS) is an FFT-based homogenization solver d
Before proceeding with the installation, ensure that your system has the necessary dependencies. The prerequisites of FANS can be installed using Spack for a streamlined setup on high-performance computing systems, or through traditional package management for personal use.
+### Traditional Installation
+
+If you're setting up FANS on a personal computer or in a non-HPC environment, follow these instructions:
+
+Please ensure you have the following dependencies installed on your system:
+
+- CMake (version 3.0 or higher)
+- MPI (mpicc and mpic++)
+- HDF5 with parallel support
+- Eigen3
+- FFTW3 with MPI support
+
+Specifically, to run FANS, you at least need the following packages:
+
+```bash
+openmpi-bin libc6 libfftw3-double3 libfftw3-mpi3 libgcc-s1 libgomp1 libhdf5-103 libopenmpi3 libstdc++6
+```
+
+To build fans, you additionally need these packages:
+
+```bash
+libhdf5-dev libopenmpi-dev libeigen3-dev libfftw3-dev libfftw3-mpi-dev
+```
+
+If for some reason you are unable to install these packages directly on your host machine, have a look at the [set of Docker images](docker/) to create and work with FANS within an isolated environment.
+
### Spack Installation (Recommended for Clusters/Supercomputers)
Spack is a package manager designed for high-performance computing environments. It simplifies the installation of complex software stacks, making it ideal for setting up FANS on large clusters or supercomputers.
@@ -47,32 +73,6 @@ Spack is a package manager designed for high-performance computing environments.
spack load cmake mpi hdf5 eigen fftw
```
-### Traditional Installation
-
-If you're setting up FANS on a personal computer or in a non-HPC environment, follow these instructions:
-
-Please ensure you have the following dependencies installed on your system:
-
-- CMake (version 3.0 or higher)
-- MPI (mpicc and mpic++)
-- HDF5 with parallel support
-- Eigen3
-- FFTW3 with MPI support
-
-Specifically, to run FANS, you at least need the following packages:
-
-```bash
-openmpi-bin libc6 libfftw3-double3 libfftw3-mpi3 libgcc-s1 libgomp1 libhdf5-103 libopenmpi3 libstdc++6
-```
-
-To build fans, you additionally need these packages:
-
-```bash
-libhdf5-dev libopenmpi-dev libeigen3-dev libfftw3-dev libfftw3-mpi-dev
-```
-
-If for some reason you are unable to install these packages directly on your host machine, have a look at the [set of Docker images](docker/) to create and work with FANS within an isolated environment.
-
### Building the Project
1. Clone the repository:
@@ -131,31 +131,99 @@ After compiling, you can install FANS (system-wide) using the following options:
apt install packages/fans-dev__.deb
```
-## Usage
+## Input File Format
To run the FANS solver, you need to provide a JSON input file specifying the problem parameters.
+Example input files can be found in the [`test/input_files`](test/input_files) directory. You can use these files as a reference to create your own input file. The input file is in JSON format and contains several fields to define the problem settings...
+
+### Microstructure Definition
+
+```json
+"ms_filename": "microstructures/sphere32.h5",
+"ms_datasetname": "/sphere/32x32x32/ms",
+"ms_L": [1.0, 1.0, 1.0]
+```
+
+- `ms_filename`: This specifies the path to the HDF5 file that contains the microstructure data.
+- `ms_datasetname`: This is the path within the HDF5 file to the specific dataset that represents the microstructure.
+- `ms_L`: Microstructure length defines the physical dimensions of the microstructure in the x, y, and z directions.
+
+### Problem Type and Material Model
+
+```json
+"matmodel": "LinearElasticIsotropic",
+"material_properties": {
+ "bulk_modulus": [62.5000, 222.222],
+ "shear_modulus": [28.8462, 166.6667]
+}
+```
+
+- `problem_type`: This defines the type of physical problem you are solving. Common options include "thermal" problems and "mechanical" problems.
+- `matmodel`: This specifies the material model to be used in the simulation. Examples include `LinearThermalIsotropic` for isotropic linear thermal problems, `LinearElasticIsotropic` for isotropic linear elastic mechanical problems, `PseudoPlasticLinearHardening` for plasticity mimicking model with linear hardening, and `VonMisesPlasticLinearIsotropicHardening` for rate independent J2 plasticity model with linear isotropic hardening.
+- `material_properties`: This provides the necessary material parameters for the chosen material model. For thermal problems, you might specify `conductivity`, while mechanical problems might require `bulk_modulus`, `shear_modulus`, `yield_stress`, and `hardening_parameter`. These properties can be defined as arrays to represent multiple phases within the microstructure.
+
+### Solver Settings
+
+```json
+"method": "cg",
+"TOL": 1e-10,
+"n_it": 100
+```
+
+- `method`: This indicates the numerical method to be used for solving the system of equations. `cg` stands for the Conjugate Gradient method, and `fp` stands for the Fixed Point method.
+- `TOL`: This sets the tolerance level for the solver. It defines the convergence criterion which is based on the L-infinity norm of the nodal finite element residual; the solver iterates until the solution meets this tolerance.
+- `n_it`: This specifies the maximum number of iterations allowed for the FANS solver.
+
+### Macroscale Loading Conditions
+
+```json
+"macroscale_loading": [
+ [
+ [0.004, -0.002, -0.002, 0, 0, 0],
+ [0.008, -0.004, -0.004, 0, 0, 0],
+ [0.012, -0.006, -0.006, 0, 0, 0],
+ [0.016, -0.008, -0.008, 0, 0, 0],
+ ],
+ [
+ [0, 0, 0, 0.002, 0, 0],
+ [0, 0, 0, 0.004, 0, 0],
+ [0, 0, 0, 0.006, 0, 0],
+ [0, 0, 0, 0.008, 0, 0],
+ ]
+ ],
+```
+
+- `macroscale_loading`: This defines the external loading applied to the microstructure. It is an array of arrays, where each sub-array represents a loading condition applied to the system. The format of the loading array depends on the problem type:
+
+ - For `thermal` problems, the array typically has 3 components, representing the temperature gradients in the x, y, and z directions.
+ - For `mechanical` problems, the array must have 6 components, corresponding to the components of the strain tensor in Mandel notation (e.g., [[ε11, ε22, ε33, ε12, ε13, ε23]]).
+
+In the case of path/time-dependent loading as shown, for example as in plasticity problems, the `macroscale_loading` array can include multiple steps with corresponding loading conditions.
+
+### Results Specification
+
+```json
+"results": ["stress_average", "strain_average", "absolute_error", "phase_stress_average", "phase_strain_average",
+ "microstructure", "displacement", "stress", "strain"]
+```
-### Input File Format
+- `results`: This array lists the quantities that should be stored into the results HDF5 file during the simulation. Each string in the array corresponds to a specific result:
-The input file is in JSON format and contains several fields to define the problem settings:
+ - `stress_average` and `strain_average`: Volume averaged- homogenized stress and strain over the entire microstructure.
+ - `absolute_error`: The L-infinity error of finite element nodal residual at each iteration.
+ - `phase_stress_average` and `phase_strain_average`: Volume averaged- homogenized stress and strain for each phase within the microstructure.
+ - `microstructure`: The original microstructure data.
+ - `displacement`: The displacement fluctuation field (for mechanical problems) and temperature fluctuation field (for thermal problems).
+ - `stress` and `strain`: The stress and strain fields at each voxel in the microstructure.
-- `ms_filename`: Path to the microstructure file (HDF5 format).
-- `ms_datasetname`: Path to the dataset inside the HDF5 file.
-- `ms_L`: List defining the domain size.
-- `matmodel`: Material model (e.g., `ThermalLinear`, `MechLinear`, `HyperElastic`).
-- `material_properties`: Material properties relevant to the chosen material model.
-- `problem_type`: Type of the problem (`thermal` or `mechanical`).
-- `method`: Solution method (`fp` for fixed point or `cg` for conjugate gradient).
-- `TOL`: Tolerance for the solver.
-- `n_it`: Maximum number of iterations.
-- `g0`: Macroscale loading vector.
+- Additional material model specific results, such as `plastic_flag`, `plastic_strain`, and `hardening_variable`, can be included depending on the problem type and material model.
-### Example
+### Examples
-To run a linear elastic mechanical homogenization problem for a single load case on a microstructure image of size `256 x 256 x 256` with a single spherical inclusion,
+If you would like to run some example tests, you can execute the [`run_tests.sh`](test/run_tests.sh) file. For example to run a linear elastic mechanical homogenization problem for a 6 othonormal load cases on a microstructure image of size `32 x 32 x 32` with a single spherical inclusion,
```bash
-mpiexec -n 1 ./FANS input_files/sphere_mech.json
+mpiexec -n 2 ./FANS input_files/test_LinearElasticIsotropic.json test_results.h5
```
## Acknowledgements
diff --git a/docs/ReleaseGuide.md b/docs/ReleaseGuide.md
new file mode 100644
index 0000000..dc99747
--- /dev/null
+++ b/docs/ReleaseGuide.md
@@ -0,0 +1,24 @@
+# Guide to release new version of FANS
+
+The developer who is releasing a new version of FANS is expected to follow this work flow:
+
+The release of the `FANS` repository is made directly from a release branch called `FANS-v1.2.3`. This branch is mainly needed to help other developers with testing.
+
+1. Create a branch called `FANS-v1.2.3` from the latest commit of the `develop` branch.
+
+2. If it is a real release, [open a Pull Request `main` <-- `FANS-v1.2.3`](https://github.com/DataAnalyticsEngineering/FANS/compare/main...main) named after the version (i.e. `Release v1.2.3`) and briefly describe the new features of the release in the PR description.
+
+3. Bump the version in the `CHANGELOG.md` and the base `CMakeLists.txt` on the branch `FANS-v1.2.3`.
+
+4. [Draft a new release](https://github.com/DataAnalyticsEngineering/FANS/releases/new) in the `Releases` section of the repository page in a web browser. The release tag needs to be the exact version number (i.e.`v1.2.3` or `v1.2.3rc1`, compare to [existing tags](https://github.com/DataAnalyticsEngineering/FANS/tags)). Use `@target:main`. Release title is also the version number (i.e. `v1.2.3` or `v1.2.3rc1`, compare to [existing releases](https://github.com/DataAnalyticsEngineering/FANS/tags)).
+
+ * *Note:* If it is a pre-release then the option *This is a pre-release* needs to be selected at the bottom of the page. Use `@target:FANS-v1.2.3` for a pre-release, since we will never merge a pre-release into `main`.
+ * Use the `Auto-generate release notes` feature.
+
+ a) If a pre-release is made: Directly hit the "Publish release" button in your Release Draft.
+
+ b) If this is a "real" release: As soon as one approving review is made, merge the release PR (from `FANS-v1.2.3`) into `main`.
+
+5. Merge `main` into `develop` for synchronization of `develop`.
+
+6. If everything is in order up to this point then the new version can be released by hitting the "Publish release" button in your Release Draft. This will create the corresponding tag.
diff --git a/test/FANS_example.png b/docs/images/FANS_example.png
similarity index 100%
rename from test/FANS_example.png
rename to docs/images/FANS_example.png
diff --git a/include/general.h b/include/general.h
index ba6f234..c164cff 100644
--- a/include/general.h
+++ b/include/general.h
@@ -3,52 +3,50 @@
#ifndef GENERAL_H_
#define GENERAL_H_
-#include
-#include
#include
-#include
-#include
-#include
+#include
#include
-#include
-#include
+#include
+#include
+#include
+#include
#include