From f1c9617fe880f963121516830b9bb4fe44a9a970 Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Mon, 13 May 2024 23:25:15 +0200 Subject: [PATCH 1/8] Update dependencies --- pyproject.toml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 718bac4..5556448 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,13 +28,15 @@ dependencies = [ [project.optional-dependencies] dev = [ - 'jupytext~=1.16.1', - 'jupyterlab~=4.1.8', - 'pre_commit~=3.7.0', - 'pytest', + 'jupyterlab~=4.2.0', + 'jupytext~=1.16.2', + 'pre-commit~=3.7.1', + 'pytest~=8.2.0', 'sphinx', - 'myst_parser', - 'sphinx_rtd_theme' + 'myst-parser~=3.0.1', + 'nbsphinx~=0.9.4', + 'sphinx-gallery~=0.16.0', + 'sphinx-rtd-theme~=2.0.0' ] [tool.flake8] From 3daedd52f45f2543bd12d119668216f8f3a09be6 Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Mon, 13 May 2024 23:28:06 +0200 Subject: [PATCH 2/8] Documentation --- docs/conf.py | 1 - docs/examples.rst | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 04e7f02..54f01e3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,6 @@ "sphinx.ext.autosectionlabel", "nbsphinx", "sphinx_gallery.load_style", - "nbsphinx_link", ] myst_enable_extensions = ["dollarmath", "amsmath"] nbsphinx_allow_errors = True diff --git a/docs/examples.rst b/docs/examples.rst index ae37f5b..8e87d84 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -2,10 +2,10 @@ Examples -------- .. nbgallery:: - examples/material_parameters.nblink - examples/truncate_ntfa_modes.nblink - examples/paper_plots.nblink - examples/generate_inputs.nblink - examples/generate_plots.nblink - examples/NTFA_thermo_paper.nblink - examples/thermoNTFA_example.nblink + examples/material_parameters + examples/truncate_ntfa_modes + examples/paper_plots + examples/generate_inputs + examples/generate_plots + examples/NTFA_thermo_paper + examples/thermoNTFA_example From 9bc84471f07d1383a6ae29c6fd8a99a56d9c253c Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Mon, 13 May 2024 23:35:06 +0200 Subject: [PATCH 3/8] Add pandoc as dependency for documentation --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b17c54..2a00b97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install pandoc + uses: pandoc/actions/setup@{main} - name: Install thermontfa run: pip install .[dev] - name: Build documentation From 9ea1b5989eb5a3d16f462f86142cae62804e0144 Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Mon, 13 May 2024 23:40:52 +0200 Subject: [PATCH 4/8] Documentation --- .github/workflows/ci.yml | 2 +- docs/index.rst | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a00b97..9d471d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: - name: Build documentation run: | cd docs - make html + TZ=UTC make html - name: Upload artifacts uses: actions/upload-artifact@v3 with: diff --git a/docs/index.rst b/docs/index.rst index 914b817..5a08d62 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,10 +14,10 @@ TODO: abstract :maxdepth: 2 :caption: Contents: - Workflow - Installation - ThermoNTFA Documentation - Examples + workflow + installation + api + examples MarkdownLinks/license MarkdownLinks/citation MarkdownLinks/changelog From cbfbfd33c8f40442c7ff6a511d62f0648b2e5638 Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Mon, 13 May 2024 23:59:45 +0200 Subject: [PATCH 5/8] Documentation --- .github/workflows/ci.yml | 4 ++-- thermontfa/tabular_interpolation.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d471d6..4294901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - ubuntu-latest # - windows-latest Reason: get it running on ubuntu-latest first # - macOS-latest Reason: get it running on ubuntu-latest first - python-version: ["3.11",] + python-version: ["3.11", "3.10"] name: Run tests runs-on: ${{ matrix.os }} steps: @@ -64,7 +64,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install pandoc - uses: pandoc/actions/setup@{main} + uses: docker://pandoc/core:2.9 - name: Install thermontfa run: pip install .[dev] - name: Build documentation diff --git a/thermontfa/tabular_interpolation.py b/thermontfa/tabular_interpolation.py index 5dec225..768ceb2 100644 --- a/thermontfa/tabular_interpolation.py +++ b/thermontfa/tabular_interpolation.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -Tabular interpolation for the NTFA +Tabular interpolation for the thermo-mechanical NTFA (c) 2024, Felix Fritzen , From ceb0cbecc35b8c7e0a6a20322aa45e0fa20e82e3 Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Tue, 14 May 2024 00:51:43 +0200 Subject: [PATCH 6/8] Update examples --- .github/workflows/ci.yml | 7 +++++-- examples/paper_plots.ipynb | 42 ++++++++++++++++++++++++-------------- examples/paper_plots.py | 20 ++++++++++-------- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4294901..36152bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: - ubuntu-latest # - windows-latest Reason: get it running on ubuntu-latest first # - macOS-latest Reason: get it running on ubuntu-latest first - python-version: ["3.11", "3.10"] + python-version: ["3.11",] name: Run tests runs-on: ${{ matrix.os }} steps: @@ -64,7 +64,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install pandoc - uses: docker://pandoc/core:2.9 + #uses: docker://pandoc/core:2.9 + run: | + apt update + apt install pandoc -y - name: Install thermontfa run: pip install .[dev] - name: Build documentation diff --git a/examples/paper_plots.ipynb b/examples/paper_plots.ipynb index 920ea4a..03dd4d1 100644 --- a/examples/paper_plots.ipynb +++ b/examples/paper_plots.ipynb @@ -25,11 +25,7 @@ "> Felix Fritzen is funded by the German Research Foundation (DFG) --\n", "> 390740016 (EXC-2075); 406068690 (FR2702/8-1); 517847245 (FR2702/10-1).\n", "\n", - "## Mode study\n", - "## Training reproduction tests\n", - "## Random loading\n", - "## Stress-driven simulation\n", - "## Twoscale simulation" + "## Imports:" ] }, { @@ -78,6 +74,18 @@ " )" ] }, + { + "cell_type": "markdown", + "id": "bd108d2a", + "metadata": {}, + "source": [ + "## Mode study\n", + "## Training reproduction tests\n", + "## Random loading\n", + "## Stress-driven simulation\n", + "## Twoscale simulation" + ] + }, { "cell_type": "markdown", "id": "9ef6456e", @@ -197,13 +205,11 @@ ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "id": "cc234c4c", "metadata": {}, - "outputs": [], "source": [ - "# ### Relative error in sig_bar for 300 and 1300 K" + "### Relative error in sig_bar for 300 and 1300 K" ] }, { @@ -719,6 +725,18 @@ " GG.create_dataset(\"xi\", data=xi)" ] }, + { + "cell_type": "markdown", + "id": "46edb92e", + "metadata": {}, + "source": [ + "1. set the stress to 0\n", + "2. ramp the temperature from 293K\n", + "3. check for q >= q_crit_0, q_crit_1, ...\n", + " e.g. q_crit_0 = 0.002 (i.e. 0.2%)\n", + "4. draw the results of theta" + ] + }, { "cell_type": "code", "execution_count": null, @@ -728,12 +746,6 @@ }, "outputs": [], "source": [ - "# 1. set the stress to 0\n", - "# 2. ramp the temperature from 293K\n", - "# 3. check for q >= q_crit_0, q_crit_1, ...\n", - "# e.g. q_crit_0 = 0.002 (i.e. 0.2%)\n", - "# draw the results of theta\n", - "\n", "n_ramp = 1300 - 293 + 1\n", "with h5py.File(\"ms9p_thermal_rampup.h5\", \"w\") as F:\n", " eps_idx = None\n", diff --git a/examples/paper_plots.py b/examples/paper_plots.py index 4f70dfe..ab2f61e 100644 --- a/examples/paper_plots.py +++ b/examples/paper_plots.py @@ -35,11 +35,7 @@ # > Felix Fritzen is funded by the German Research Foundation (DFG) -- # > 390740016 (EXC-2075); 406068690 (FR2702/8-1); 517847245 (FR2702/10-1). # -# ## Mode study -# ## Training reproduction tests -# ## Random loading -# ## Stress-driven simulation -# ## Twoscale simulation +# ## Imports: # %% import os @@ -81,6 +77,13 @@ def rel_error(A, A_ref, r_min=None): ) +# %% [markdown] +# ## Mode study +# ## Training reproduction tests +# ## Random loading +# ## Stress-driven simulation +# ## Twoscale simulation + # %% [markdown] # **Load the NTFA data** @@ -169,7 +172,7 @@ def rel_error(A, A_ref, r_min=None): ntfa_q = np.array(F["/ntfa/q"]) ntfa_xi = np.array(F["/ntfa/xi"]) -# %% +# %% [markdown] # ### Relative error in sig_bar for 300 and 1300 K # %% @@ -608,13 +611,14 @@ def rel_error(A, A_ref, r_min=None): GG.create_dataset("xi", data=xi) -# %% Figuring when palsticity kicks in using the mixed UMAT +# %% [markdown] # 1. set the stress to 0 # 2. ramp the temperature from 293K # 3. check for q >= q_crit_0, q_crit_1, ... # e.g. q_crit_0 = 0.002 (i.e. 0.2%) -# draw the results of theta +# 4. draw the results of theta +# %% Figuring when palsticity kicks in using the mixed UMAT n_ramp = 1300 - 293 + 1 with h5py.File("ms9p_thermal_rampup.h5", "w") as F: eps_idx = None From c031d0eede0153fce9835dc60c8820437b576fb8 Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Tue, 14 May 2024 00:57:23 +0200 Subject: [PATCH 7/8] Update ntfa --- .github/workflows/ci.yml | 4 ++-- thermontfa/thermoNTFA.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36152bd..c91c049 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,8 @@ jobs: - name: Install pandoc #uses: docker://pandoc/core:2.9 run: | - apt update - apt install pandoc -y + sudo apt update + sudo apt install pandoc -y - name: Install thermontfa run: pip install .[dev] - name: Build documentation diff --git a/thermontfa/thermoNTFA.py b/thermontfa/thermoNTFA.py index cb7fbb6..4c3e1fd 100644 --- a/thermontfa/thermoNTFA.py +++ b/thermontfa/thermoNTFA.py @@ -22,7 +22,7 @@ 390740016 (EXC-2075); 406068690 (FR2702/8-1); 517847245 (FR2702/10-1). """ -from typing import Callable, Optional, Tuple +from typing import Callable, Optional, Tuple, List import h5py import numpy as np @@ -39,6 +39,17 @@ class ThermoMechNTFA: """ # TODO: Document properties + file_name: str + group_name: str + sig_y: Callable[[float, float, bool], float] + tol: float + verbose: bool = False + A_bar: TabularInterpolation + C_bar: TabularInterpolation + D_xi: TabularInterpolation + tau_theta: TabularInterpolation + tau_xi: TabularInterpolation + sig_phases: List def __init__( self, From b4cb1884f6032e6a015e476b819109715a87488a Mon Sep 17 00:00:00 2001 From: Julius Herb Date: Tue, 14 May 2024 01:03:38 +0200 Subject: [PATCH 8/8] Update documentation --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/conf.py b/docs/conf.py index 54f01e3..b86e240 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,6 +27,7 @@ ] myst_enable_extensions = ["dollarmath", "amsmath"] nbsphinx_allow_errors = True +autodoc_member_order = "bysource" templates_path = ["_templates"] exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]