From ad52d8a158e47275937d7728bf26670b6fcff8b4 Mon Sep 17 00:00:00 2001 From: Sanath Date: Wed, 17 Sep 2025 16:07:48 +0200 Subject: [PATCH 1/2] plasticity fix --- .../fans_dashboard/plotting/plotting.py | 4 +- FANS_Dashboard/pyproject.toml | 1 + include/material_models/J2Plasticity.h | 36 ++-- include/material_models/PseudoPlastic.h | 20 +- pixi.lock | 192 +++++++++++++++++- 5 files changed, 212 insertions(+), 41 deletions(-) diff --git a/FANS_Dashboard/fans_dashboard/plotting/plotting.py b/FANS_Dashboard/fans_dashboard/plotting/plotting.py index 840738e..719454f 100644 --- a/FANS_Dashboard/fans_dashboard/plotting/plotting.py +++ b/FANS_Dashboard/fans_dashboard/plotting/plotting.py @@ -149,8 +149,8 @@ def plot_subplots( # Update layout with the overall plot title and styling fig.update_layout( - height=1000, - width=1600, + height=500, + width=800, title_text=title, title_font=dict(size=fontsize), showlegend=False, # Legends removed diff --git a/FANS_Dashboard/pyproject.toml b/FANS_Dashboard/pyproject.toml index e1ef4c8..0f3fd1b 100644 --- a/FANS_Dashboard/pyproject.toml +++ b/FANS_Dashboard/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ "lxml", "scipy", "meshio", + "nbformat", ] [tool.hatch.build.targets.wheel] diff --git a/include/material_models/J2Plasticity.h b/include/material_models/J2Plasticity.h index ea918ed..d0b9a42 100644 --- a/include/material_models/J2Plasticity.h +++ b/include/material_models/J2Plasticity.h @@ -22,17 +22,16 @@ class J2Plasticity : public MechModel { } n_mat = bulk_modulus.size(); - Matrix *Ce = new Matrix[n_mat]; - Matrix topLeft = Matrix::Zero(); - topLeft.topLeftCorner(3, 3).setConstant(1); - - kapparef_mat = Matrix::Zero(); - for (int i = 0; i < n_mat; ++i) { - Ce[i] = 3 * bulk_modulus[i] * topLeft + - 2 * shear_modulus[i] * (-1.0 / 3.0 * topLeft + Matrix::Identity()); - kapparef_mat += Ce[i]; + Matrix Pvol = Matrix::Zero(); + Pvol.topLeftCorner(3, 3).setConstant(1.0 / 3.0); // volumetric projector + const Matrix I6 = Matrix::Identity(); + const Matrix Pdev = I6 - Pvol; // deviatoric projector + + Matrix Ce_sum = Matrix::Zero(); + for (size_t i = 0; i < n_mat; ++i) { + Ce_sum += 3.0 * bulk_modulus[i] * Pvol + 2.0 * shear_modulus[i] * Pdev; } - kapparef_mat /= n_mat; + kapparef_mat = Ce_sum / static_cast(n_mat); // Allocate the member matrices/vectors for performance optimization sqrt_two_over_three = sqrt(2.0 / 3.0); @@ -81,7 +80,7 @@ class J2Plasticity : public MechModel { treps = eps_elastic.head<3>().sum(); // Compute trial stress - sigma_trial_n1.head<3>().setConstant(bulk_modulus[mat_index] * treps); + sigma_trial_n1.head<3>().setConstant((bulk_modulus[mat_index] - 2.0 * shear_modulus[mat_index] / 3.0) * treps); sigma_trial_n1.head<3>() += 2 * shear_modulus[mat_index] * eps_elastic.head<3>(); sigma_trial_n1.tail<3>() = 2 * shear_modulus[mat_index] * eps_elastic.tail<3>(); @@ -90,16 +89,19 @@ class J2Plasticity : public MechModel { dev.head<3>().array() -= sigma_trial_n1.head<3>().mean(); // Compute trial q and q_bar - q_trial_n1 = compute_q_trial(psi_t[element_idx](i / n_str), mat_index); - qbar_trial_n1.head<3>() = -H[mat_index] * (2.0 / 3.0) * psi_bar_t[element_idx].col(i / n_str).head<3>(); - qbar_trial_n1.tail<3>().setZero(); // Lower part is zero + q_trial_n1 = compute_q_trial(psi_t[element_idx](i / n_str), mat_index); + qbar_trial_n1 = -(2.0 / 3.0) * H[mat_index] * psi_bar_t[element_idx].col(i / n_str); // Calculate the trial yield function dev_minus_qbar = dev - qbar_trial_n1; norm_dev_minus_qbar = dev_minus_qbar.norm(); // Avoid division by zero - n = (norm_dev_minus_qbar < 1e-12) ? n.setZero() : dev_minus_qbar / norm_dev_minus_qbar; + if (norm_dev_minus_qbar < 1e-12) { + n.setZero(); + } else { + n = dev_minus_qbar / norm_dev_minus_qbar; + } f_trial = norm_dev_minus_qbar - sqrt_two_over_three * (yield_stress[mat_index] - q_trial_n1); @@ -191,7 +193,7 @@ class J2ViscoPlastic_NonLinearIsotropicHardening : public J2Plasticity { denominator.resize(n_mat); sigma_diff.resize(n_mat); for (size_t i = 0; i < n_mat; ++i) { - denominator[i] = 2 * shear_modulus[i] + H[i] * (2.0 / 3.0) + eta[i] / dt; + denominator[i] = 2 * shear_modulus[i] + (2.0 / 3.0) * (K[i] + H[i]) + eta[i] / dt; sigma_diff[i] = sqrt_two_over_three * (sigma_inf[i] - yield_stress[i]); } } @@ -239,7 +241,7 @@ class J2ViscoPlastic_NonLinearIsotropicHardening : public J2Plasticity { vector sigma_diff; // sqrt(2/3) * (sigma_inf - yield_stress) }; -void J2Plasticity::postprocess(Solver<3> &solver, Reader &reader, const char *resultsFileName, int load_idx, int time_idx) +inline void J2Plasticity::postprocess(Solver<3> &solver, Reader &reader, const char *resultsFileName, int load_idx, int time_idx) { int n_str = 6; // The plastic strain and stress vectors have 6 components each VectorXd mean_plastic_strain = VectorXd::Zero(solver.local_n0 * solver.n_y * solver.n_z * n_str); diff --git a/include/material_models/PseudoPlastic.h b/include/material_models/PseudoPlastic.h index b47f8ac..a4c7eff 100644 --- a/include/material_models/PseudoPlastic.h +++ b/include/material_models/PseudoPlastic.h @@ -32,18 +32,16 @@ class PseudoPlastic : public MechModel { } n_mat = bulk_modulus.size(); - // Initialize stiffness matrix (assuming for two materials, otherwise needs extension) - Matrix *Ce = new Matrix[n_mat]; - Matrix topLeft = Matrix::Zero(); - topLeft.topLeftCorner(3, 3).setConstant(1); - - kapparef_mat = Matrix::Zero(); - for (int i = 0; i < n_mat; ++i) { - Ce[i] = 3 * bulk_modulus[i] * topLeft + - 2 * shear_modulus[i] * (-1.0 / 3.0 * topLeft + Matrix::Identity()); - kapparef_mat += Ce[i]; + Matrix Pvol = Matrix::Zero(); + Pvol.topLeftCorner(3, 3).setConstant(1.0 / 3.0); // volumetric projector + const Matrix I6 = Matrix::Identity(); + const Matrix Pdev = I6 - Pvol; // deviatoric projector + + Matrix Ce_sum = Matrix::Zero(); + for (size_t i = 0; i < n_mat; ++i) { + Ce_sum += 3.0 * bulk_modulus[i] * Pvol + 2.0 * shear_modulus[i] * Pdev; } - kapparef_mat /= n_mat; + kapparef_mat = Ce_sum / static_cast(n_mat); } void initializeInternalVariables(ptrdiff_t num_elements, int num_gauss_points) override diff --git a/pixi.lock b/pixi.lock index bf7ba4b..0881f27 100644 --- a/pixi.lock +++ b/pixi.lock @@ -104,16 +104,23 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-64/yaml-0.2.5-h7f98852_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/linux-64/zeromq-4.3.5-h3b0a872_7.conda - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhd8ed1ab_0.conda + - pypi: https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/cb/a8/20d0723294217e47de6d9e2e40fd4a9d2f7c4b6ef974babd482a59743694/fastjsonschema-2.21.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/e7/ec/86f59025306dcc6deee5fda54d980d077075b8d9889aac80f158bd585f1b/h5py-3.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + - pypi: https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/d4/dd/39c8507c16db6031f8c1ddf70ed95dbb0a6d466a40002a3522c128aba472/lxml-6.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl - pypi: https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/89/5f/39cbadc320cd78f4834b0a9f7a2fa3c980dca942bf193f315837eacb8870/meshio-5.3.5-py3-none-any.whl - - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#0a73efa5bc7893c68c299b1850c99c647d31a2d5 + - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#a8061e3854e46b6d6593fe6e922f5a36fbaf2d75 - pypi: https://files.pythonhosted.org/packages/fe/a4/337a229d184b23ee63e6b730ac1588d77067af77c550dbf69cf1d74c3298/narwhals-1.45.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/a9/82/0340caa499416c78e5d8f5f05947ae4bc3cba53c9f038ab6e9ed964e22f1/nbformat-5.10.4-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ed/20/f2b7ac96a91cc5f70d81320adad24cc41bf52013508d649b1481db225780/plotly-6.2.0-py3-none-any.whl - - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#32259576d5bb51491983067172ff7b8251a64acf + - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#ec67f44d30b7947213af6c16a5304162df9e1bb6 + - pypi: https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/03/36/0a14aebbaa26fe7fab4780c76f2239e76cc95a0090bdb25e31d95c492fcd/rpds_py-0.27.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl - pypi: https://files.pythonhosted.org/packages/11/6b/3443abcd0707d52e48eb315e33cc669a95e29fc102229919646f5a501171/scipy-1.16.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl - pypi: ./FANS_Dashboard osx-64: @@ -207,16 +214,23 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-64/yaml-0.2.5-h0d85af4_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-64/zeromq-4.3.5-h7130eaa_7.conda - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhd8ed1ab_0.conda + - pypi: https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/cb/a8/20d0723294217e47de6d9e2e40fd4a9d2f7c4b6ef974babd482a59743694/fastjsonschema-2.21.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/6c/c2/7efe82d09ca10afd77cd7c286e42342d520c049a8c43650194928bcc635c/h5py-3.14.0-cp313-cp313-macosx_10_13_x86_64.whl + - pypi: https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/a4/f6/051b1607a459db670fc3a244fa4f06f101a8adf86cda263d1a56b3a4f9d5/lxml-6.0.0-cp313-cp313-macosx_10_13_x86_64.whl - pypi: https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/89/5f/39cbadc320cd78f4834b0a9f7a2fa3c980dca942bf193f315837eacb8870/meshio-5.3.5-py3-none-any.whl - - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#0a73efa5bc7893c68c299b1850c99c647d31a2d5 + - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#a8061e3854e46b6d6593fe6e922f5a36fbaf2d75 - pypi: https://files.pythonhosted.org/packages/fe/a4/337a229d184b23ee63e6b730ac1588d77067af77c550dbf69cf1d74c3298/narwhals-1.45.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/a9/82/0340caa499416c78e5d8f5f05947ae4bc3cba53c9f038ab6e9ed964e22f1/nbformat-5.10.4-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ed/20/f2b7ac96a91cc5f70d81320adad24cc41bf52013508d649b1481db225780/plotly-6.2.0-py3-none-any.whl - - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#32259576d5bb51491983067172ff7b8251a64acf + - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#ec67f44d30b7947213af6c16a5304162df9e1bb6 + - pypi: https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/cc/77/610aeee8d41e39080c7e14afa5387138e3c9fa9756ab893d09d99e7d8e98/rpds_py-0.27.1-cp313-cp313-macosx_10_12_x86_64.whl - pypi: https://files.pythonhosted.org/packages/46/95/0746417bc24be0c2a7b7563946d61f670a3b491b76adede420e9d173841f/scipy-1.16.0-cp313-cp313-macosx_10_14_x86_64.whl - pypi: ./FANS_Dashboard osx-arm64: @@ -310,16 +324,23 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/yaml-0.2.5-h3422bc3_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zeromq-4.3.5-hc1bb282_7.conda - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhd8ed1ab_0.conda + - pypi: https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/cb/a8/20d0723294217e47de6d9e2e40fd4a9d2f7c4b6ef974babd482a59743694/fastjsonschema-2.21.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/4f/31/f570fab1239b0d9441024b92b6ad03bb414ffa69101a985e4c83d37608bd/h5py-3.14.0-cp313-cp313-macosx_11_0_arm64.whl + - pypi: https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/79/21/6e7c060822a3c954ff085e5e1b94b4a25757c06529eac91e550f3f5cd8b8/lxml-6.0.0-cp313-cp313-macosx_10_13_universal2.whl - pypi: https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/89/5f/39cbadc320cd78f4834b0a9f7a2fa3c980dca942bf193f315837eacb8870/meshio-5.3.5-py3-none-any.whl - - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#0a73efa5bc7893c68c299b1850c99c647d31a2d5 + - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#a8061e3854e46b6d6593fe6e922f5a36fbaf2d75 - pypi: https://files.pythonhosted.org/packages/fe/a4/337a229d184b23ee63e6b730ac1588d77067af77c550dbf69cf1d74c3298/narwhals-1.45.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/a9/82/0340caa499416c78e5d8f5f05947ae4bc3cba53c9f038ab6e9ed964e22f1/nbformat-5.10.4-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ed/20/f2b7ac96a91cc5f70d81320adad24cc41bf52013508d649b1481db225780/plotly-6.2.0-py3-none-any.whl - - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#32259576d5bb51491983067172ff7b8251a64acf + - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#ec67f44d30b7947213af6c16a5304162df9e1bb6 + - pypi: https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/3a/fc/c43765f201c6a1c60be2043cbdb664013def52460a4c7adace89d6682bf4/rpds_py-0.27.1-cp313-cp313-macosx_11_0_arm64.whl - pypi: https://files.pythonhosted.org/packages/19/5a/914355a74481b8e4bbccf67259bbde171348a3f160b67b4945fbc5f5c1e5/scipy-1.16.0-cp313-cp313-macosx_12_0_arm64.whl - pypi: ./FANS_Dashboard win-64: @@ -410,16 +431,23 @@ environments: - conda: https://conda.anaconda.org/conda-forge/win-64/yaml-0.2.5-h8ffe710_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/win-64/zeromq-4.3.5-ha9f60a1_7.conda - conda: https://conda.anaconda.org/conda-forge/noarch/zipp-3.23.0-pyhd8ed1ab_0.conda + - pypi: https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/cb/a8/20d0723294217e47de6d9e2e40fd4a9d2f7c4b6ef974babd482a59743694/fastjsonschema-2.21.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/3f/6d/0084ed0b78d4fd3e7530c32491f2884140d9b06365dac8a08de726421d4a/h5py-3.14.0-cp313-cp313-win_amd64.whl + - pypi: https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/f4/87/6456b9541d186ee7d4cb53bf1b9a0d7f3b1068532676940fdd594ac90865/lxml-6.0.0-cp313-cp313-win_amd64.whl - pypi: https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/89/5f/39cbadc320cd78f4834b0a9f7a2fa3c980dca942bf193f315837eacb8870/meshio-5.3.5-py3-none-any.whl - - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#0a73efa5bc7893c68c299b1850c99c647d31a2d5 + - pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#a8061e3854e46b6d6593fe6e922f5a36fbaf2d75 - pypi: https://files.pythonhosted.org/packages/fe/a4/337a229d184b23ee63e6b730ac1588d77067af77c550dbf69cf1d74c3298/narwhals-1.45.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/a9/82/0340caa499416c78e5d8f5f05947ae4bc3cba53c9f038ab6e9ed964e22f1/nbformat-5.10.4-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/ed/20/f2b7ac96a91cc5f70d81320adad24cc41bf52013508d649b1481db225780/plotly-6.2.0-py3-none-any.whl - - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#32259576d5bb51491983067172ff7b8251a64acf + - pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#ec67f44d30b7947213af6c16a5304162df9e1bb6 + - pypi: https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl - pypi: https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl + - pypi: https://files.pythonhosted.org/packages/ce/2c/5867b14a81dc217b56d95a9f2a40fdbc56a1ab0181b80132beeecbd4b2d6/rpds_py-0.27.1-cp313-cp313-win_amd64.whl - pypi: https://files.pythonhosted.org/packages/7c/a7/4c94bbe91f12126b8bf6709b2471900577b7373a4fd1f431f28ba6f81115/scipy-1.16.0-cp313-cp313-win_amd64.whl - pypi: ./FANS_Dashboard packages: @@ -468,6 +496,52 @@ packages: - pkg:pypi/asttokens?source=hash-mapping size: 28206 timestamp: 1733250564754 +- pypi: https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl + name: attrs + version: 25.3.0 + sha256: 427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3 + requires_dist: + - cloudpickle ; platform_python_implementation == 'CPython' and extra == 'benchmark' + - hypothesis ; extra == 'benchmark' + - mypy>=1.11.1 ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'benchmark' + - pympler ; extra == 'benchmark' + - pytest-codspeed ; extra == 'benchmark' + - pytest-mypy-plugins ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'benchmark' + - pytest-xdist[psutil] ; extra == 'benchmark' + - pytest>=4.3.0 ; extra == 'benchmark' + - cloudpickle ; platform_python_implementation == 'CPython' and extra == 'cov' + - coverage[toml]>=5.3 ; extra == 'cov' + - hypothesis ; extra == 'cov' + - mypy>=1.11.1 ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'cov' + - pympler ; extra == 'cov' + - pytest-mypy-plugins ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'cov' + - pytest-xdist[psutil] ; extra == 'cov' + - pytest>=4.3.0 ; extra == 'cov' + - cloudpickle ; platform_python_implementation == 'CPython' and extra == 'dev' + - hypothesis ; extra == 'dev' + - mypy>=1.11.1 ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'dev' + - pre-commit-uv ; extra == 'dev' + - pympler ; extra == 'dev' + - pytest-mypy-plugins ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'dev' + - pytest-xdist[psutil] ; extra == 'dev' + - pytest>=4.3.0 ; extra == 'dev' + - cogapp ; extra == 'docs' + - furo ; extra == 'docs' + - myst-parser ; extra == 'docs' + - sphinx ; extra == 'docs' + - sphinx-notfound-page ; extra == 'docs' + - sphinxcontrib-towncrier ; extra == 'docs' + - towncrier ; extra == 'docs' + - cloudpickle ; platform_python_implementation == 'CPython' and extra == 'tests' + - hypothesis ; extra == 'tests' + - mypy>=1.11.1 ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'tests' + - pympler ; extra == 'tests' + - pytest-mypy-plugins ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'tests' + - pytest-xdist[psutil] ; extra == 'tests' + - pytest>=4.3.0 ; extra == 'tests' + - mypy>=1.11.1 ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'tests-mypy' + - pytest-mypy-plugins ; python_full_version >= '3.10' and platform_python_implementation == 'CPython' and extra == 'tests-mypy' + requires_python: '>=3.8' - conda: https://conda.anaconda.org/conda-forge/noarch/beartype-0.21.0-pyhd8ed1ab_0.conda sha256: 0903a3f2e57c422f9ad8d1e182c5eef5278c5c962f41a8f938d0f68effca329c md5: 526bf12efa59226d9f76cd6742debc41 @@ -754,7 +828,7 @@ packages: - pypi: ./FANS_Dashboard name: fans-dashboard version: 0.4.2 - sha256: 353fb2a0d57d42f00ea7172d5e241af687e3bb83c78416fc836e6f9aabb94b19 + sha256: ad0378e406fc542f24213be9d43cbb0423a34caf0c72e5a96915d4b875cce53a requires_dist: - numpy - h5py @@ -762,8 +836,22 @@ packages: - lxml - scipy - meshio + - nbformat requires_python: '>=3.9' editable: true +- pypi: https://files.pythonhosted.org/packages/cb/a8/20d0723294217e47de6d9e2e40fd4a9d2f7c4b6ef974babd482a59743694/fastjsonschema-2.21.2-py3-none-any.whl + name: fastjsonschema + version: 2.21.2 + sha256: 1c797122d0a86c5cace2e54bf4e819c36223b552017172f32c5c024a6b77e463 + requires_dist: + - colorama ; extra == 'devel' + - jsonschema ; extra == 'devel' + - json-spec ; extra == 'devel' + - pylint ; extra == 'devel' + - pytest ; extra == 'devel' + - pytest-benchmark ; extra == 'devel' + - pytest-cache ; extra == 'devel' + - validictory ; extra == 'devel' - conda: https://conda.anaconda.org/conda-forge/noarch/filelock-3.18.0-pyhd8ed1ab_0.conda sha256: de7b6d4c4f865609ae88db6fa03c8b7544c2452a1aa5451eb7700aad16824570 md5: 4547b39256e296bb758166893e909a7c @@ -1072,6 +1160,40 @@ packages: - pkg:pypi/jedi?source=hash-mapping size: 843646 timestamp: 1733300981994 +- pypi: https://files.pythonhosted.org/packages/bf/9c/8c95d856233c1f82500c2450b8c68576b4cf1c871db3afac5c34ff84e6fd/jsonschema-4.25.1-py3-none-any.whl + name: jsonschema + version: 4.25.1 + sha256: 3fba0169e345c7175110351d456342c364814cfcf3b964ba4587f22915230a63 + requires_dist: + - attrs>=22.2.0 + - jsonschema-specifications>=2023.3.6 + - referencing>=0.28.4 + - rpds-py>=0.7.1 + - fqdn ; extra == 'format' + - idna ; extra == 'format' + - isoduration ; extra == 'format' + - jsonpointer>1.13 ; extra == 'format' + - rfc3339-validator ; extra == 'format' + - rfc3987 ; extra == 'format' + - uri-template ; extra == 'format' + - webcolors>=1.11 ; extra == 'format' + - fqdn ; extra == 'format-nongpl' + - idna ; extra == 'format-nongpl' + - isoduration ; extra == 'format-nongpl' + - jsonpointer>1.13 ; extra == 'format-nongpl' + - rfc3339-validator ; extra == 'format-nongpl' + - rfc3986-validator>0.1.0 ; extra == 'format-nongpl' + - rfc3987-syntax>=1.1.0 ; extra == 'format-nongpl' + - uri-template ; extra == 'format-nongpl' + - webcolors>=24.6.0 ; extra == 'format-nongpl' + requires_python: '>=3.9' +- pypi: https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl + name: jsonschema-specifications + version: 2025.9.1 + sha256: 98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe + requires_dist: + - referencing>=0.31.0 + requires_python: '>=3.9' - conda: https://conda.anaconda.org/conda-forge/noarch/jupyter_client-8.6.3-pyhd8ed1ab_1.conda sha256: 19d8bd5bb2fde910ec59e081eeb59529491995ce0d653a5209366611023a0b3a md5: 4ebae00eae9705b0c3d6d1018a81d047 @@ -2203,7 +2325,7 @@ packages: - pkg:pypi/mpmath?source=hash-mapping size: 439705 timestamp: 1733302781386 -- pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#0a73efa5bc7893c68c299b1850c99c647d31a2d5 +- pypi: git+https://github.com/DataAnalyticsEngineering/MSUtils.git#a8061e3854e46b6d6593fe6e922f5a36fbaf2d75 name: msutils version: 0.1.0 - pypi: https://files.pythonhosted.org/packages/fe/a4/337a229d184b23ee63e6b730ac1588d77067af77c550dbf69cf1d74c3298/narwhals-1.45.0-py3-none-any.whl @@ -2226,6 +2348,25 @@ packages: - pyspark[connect]>=3.5.0 ; extra == 'pyspark-connect' - sqlframe>=3.22.0 ; extra == 'sqlframe' requires_python: '>=3.9' +- pypi: https://files.pythonhosted.org/packages/a9/82/0340caa499416c78e5d8f5f05947ae4bc3cba53c9f038ab6e9ed964e22f1/nbformat-5.10.4-py3-none-any.whl + name: nbformat + version: 5.10.4 + sha256: 3b48d6c8fbca4b299bf3982ea7db1af21580e4fec269ad087b9e81588891200b + requires_dist: + - fastjsonschema>=2.15 + - jsonschema>=2.6 + - jupyter-core>=4.12,!=5.0.* + - traitlets>=5.1 + - myst-parser ; extra == 'docs' + - pydata-sphinx-theme ; extra == 'docs' + - sphinx ; extra == 'docs' + - sphinxcontrib-github-alt ; extra == 'docs' + - sphinxcontrib-spelling ; extra == 'docs' + - pep440 ; extra == 'test' + - pre-commit ; extra == 'test' + - pytest ; extra == 'test' + - testpath ; extra == 'test' + requires_python: '>=3.8' - conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda sha256: 3fde293232fa3fca98635e1167de6b7c7fda83caf24b9d6c91ec9eefb4f4d586 md5: 47e340acb35de30501a76c7c799c41d7 @@ -2640,7 +2781,7 @@ packages: - pkg:pypi/pygments?source=compressed-mapping size: 889287 timestamp: 1750615908735 -- pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#32259576d5bb51491983067172ff7b8251a64acf +- pypi: git+https://github.com/FlorianPfaff/pyRecEst.git#ec67f44d30b7947213af6c16a5304162df9e1bb6 name: pyrecest version: 0.0.0 - conda: https://conda.anaconda.org/conda-forge/noarch/pytest-8.4.1-pyhd8ed1ab_0.conda @@ -3019,6 +3160,15 @@ packages: purls: [] size: 252359 timestamp: 1740379663071 +- pypi: https://files.pythonhosted.org/packages/c1/b1/3baf80dc6d2b7bc27a95a67752d0208e410351e3feb4eb78de5f77454d8d/referencing-0.36.2-py3-none-any.whl + name: referencing + version: 0.36.2 + sha256: e8699adbbf8b5c7de96d8ffa0eb5c158b3beafce084968e2ea8bb08c6794dcd0 + requires_dist: + - attrs>=22.2.0 + - rpds-py>=0.7.0 + - typing-extensions>=4.4.0 ; python_full_version < '3.13' + requires_python: '>=3.9' - pypi: https://files.pythonhosted.org/packages/0d/9b/63f4c7ebc259242c89b3acafdb37b41d1185c07ff0011164674e9076b491/rich-14.0.0-py3-none-any.whl name: rich version: 14.0.0 @@ -3029,6 +3179,26 @@ packages: - pygments>=2.13.0,<3.0.0 - typing-extensions>=4.0.0,<5.0 ; python_full_version < '3.11' requires_python: '>=3.8.0' +- pypi: https://files.pythonhosted.org/packages/03/36/0a14aebbaa26fe7fab4780c76f2239e76cc95a0090bdb25e31d95c492fcd/rpds_py-0.27.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl + name: rpds-py + version: 0.27.1 + sha256: 2efe4eb1d01b7f5f1939f4ef30ecea6c6b3521eec451fb93191bf84b2a522418 + requires_python: '>=3.9' +- pypi: https://files.pythonhosted.org/packages/3a/fc/c43765f201c6a1c60be2043cbdb664013def52460a4c7adace89d6682bf4/rpds_py-0.27.1-cp313-cp313-macosx_11_0_arm64.whl + name: rpds-py + version: 0.27.1 + sha256: 1441811a96eadca93c517d08df75de45e5ffe68aa3089924f963c782c4b898cf + requires_python: '>=3.9' +- pypi: https://files.pythonhosted.org/packages/cc/77/610aeee8d41e39080c7e14afa5387138e3c9fa9756ab893d09d99e7d8e98/rpds_py-0.27.1-cp313-cp313-macosx_10_12_x86_64.whl + name: rpds-py + version: 0.27.1 + sha256: e4b9fcfbc021633863a37e92571d6f91851fa656f0180246e84cbd8b3f6b329b + requires_python: '>=3.9' +- pypi: https://files.pythonhosted.org/packages/ce/2c/5867b14a81dc217b56d95a9f2a40fdbc56a1ab0181b80132beeecbd4b2d6/rpds_py-0.27.1-cp313-cp313-win_amd64.whl + name: rpds-py + version: 0.27.1 + sha256: f9025faafc62ed0b75a53e541895ca272815bec18abe2249ff6501c8f2e12b83 + requires_python: '>=3.9' - pypi: https://files.pythonhosted.org/packages/11/6b/3443abcd0707d52e48eb315e33cc669a95e29fc102229919646f5a501171/scipy-1.16.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl name: scipy version: 1.16.0 From 06c01f8170ae4f9785590d4a8e3212dd6366caa2 Mon Sep 17 00:00:00 2001 From: Sanath Date: Thu, 18 Sep 2025 09:48:11 +0200 Subject: [PATCH 2/2] simplified ref stiffness computation --- include/material_models/J2Plasticity.h | 16 ++++++---------- include/material_models/PseudoPlastic.h | 16 ++++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/include/material_models/J2Plasticity.h b/include/material_models/J2Plasticity.h index d0b9a42..adb4979 100644 --- a/include/material_models/J2Plasticity.h +++ b/include/material_models/J2Plasticity.h @@ -22,16 +22,12 @@ class J2Plasticity : public MechModel { } n_mat = bulk_modulus.size(); - Matrix Pvol = Matrix::Zero(); - Pvol.topLeftCorner(3, 3).setConstant(1.0 / 3.0); // volumetric projector - const Matrix I6 = Matrix::Identity(); - const Matrix Pdev = I6 - Pvol; // deviatoric projector - - Matrix Ce_sum = Matrix::Zero(); - for (size_t i = 0; i < n_mat; ++i) { - Ce_sum += 3.0 * bulk_modulus[i] * Pvol + 2.0 * shear_modulus[i] * Pdev; - } - kapparef_mat = Ce_sum / static_cast(n_mat); + const double Kbar = std::accumulate(bulk_modulus.begin(), bulk_modulus.end(), 0.0) / static_cast(n_mat); + const double Gbar = std::accumulate(shear_modulus.begin(), shear_modulus.end(), 0.0) / static_cast(n_mat); + const double lambdabar = Kbar - 2.0 * Gbar / 3.0; + kapparef_mat.setZero(); + kapparef_mat.topLeftCorner(3, 3).setConstant(lambdabar); + kapparef_mat.diagonal().array() += 2.0 * Gbar; // Allocate the member matrices/vectors for performance optimization sqrt_two_over_three = sqrt(2.0 / 3.0); diff --git a/include/material_models/PseudoPlastic.h b/include/material_models/PseudoPlastic.h index a4c7eff..15e085a 100644 --- a/include/material_models/PseudoPlastic.h +++ b/include/material_models/PseudoPlastic.h @@ -32,16 +32,12 @@ class PseudoPlastic : public MechModel { } n_mat = bulk_modulus.size(); - Matrix Pvol = Matrix::Zero(); - Pvol.topLeftCorner(3, 3).setConstant(1.0 / 3.0); // volumetric projector - const Matrix I6 = Matrix::Identity(); - const Matrix Pdev = I6 - Pvol; // deviatoric projector - - Matrix Ce_sum = Matrix::Zero(); - for (size_t i = 0; i < n_mat; ++i) { - Ce_sum += 3.0 * bulk_modulus[i] * Pvol + 2.0 * shear_modulus[i] * Pdev; - } - kapparef_mat = Ce_sum / static_cast(n_mat); + const double Kbar = std::accumulate(bulk_modulus.begin(), bulk_modulus.end(), 0.0) / static_cast(n_mat); + const double Gbar = std::accumulate(shear_modulus.begin(), shear_modulus.end(), 0.0) / static_cast(n_mat); + const double lambdabar = Kbar - 2.0 * Gbar / 3.0; + kapparef_mat.setZero(); + kapparef_mat.topLeftCorner(3, 3).setConstant(lambdabar); + kapparef_mat.diagonal().array() += 2.0 * Gbar; } void initializeInternalVariables(ptrdiff_t num_elements, int num_gauss_points) override