.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/analysis/objective_rates.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_analysis_objective_rates.py: Comparison of objective rates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This example show the well-known spurious oscillations that can occur in the Zaremba-Jauman rate when simulating elastic responses under large transformations. The results are compared with the Green-Naghdi and logarithmic Xiao-Meyers-Bruhns rates, which do not exhibit such oscillations. .. GENERATED FROM PYTHON SOURCE LINES 9-22 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from simcoon import simmit as sim import os plt.rcParams["figure.figsize"] = (18, 10) # configure the figure output size dir = os.path.dirname(os.path.realpath("__file__")) plt.rc("text", usetex=True) plt.rc("font", family="serif") .. GENERATED FROM PYTHON SOURCE LINES 23-27 We first consider an material with isotropic elastic behavior defined by its Young modulus and Poisson ratio. The material is subjected to a large simple shear deformation. Not that of course this example is only illustrative since for large deformations elastic materials are not physically meaningful. .. GENERATED FROM PYTHON SOURCE LINES 27-49 .. code-block:: Python umat_name = "ELISO" # This is the 5 character code for the elastic-isotropic subroutine nstatev = 1 # The number of scalar variables required, only the initial temperature is stored here E = 70000.0 nu = 0.3 alpha = 1.0e-5 psi_rve = 0.0 theta_rve = 0.0 phi_rve = 0.0 solver_type = 0 props = np.array([E, nu, alpha]) path_data = "data" path_results = "results" pathfile = "path.txt" colors = ["blue", "red", "green", "black"] .. GENERATED FROM PYTHON SOURCE LINES 50-51 In here the the three objective rates are compared : Jaumann, Green-Naghdi and Logarithmic .. GENERATED FROM PYTHON SOURCE LINES 51-54 .. code-block:: Python rate = ["Jaumann", "Green-Naghdi", "Logarithmic"] .. GENERATED FROM PYTHON SOURCE LINES 55-61 Note that the loading path is described in the file `path.txt` : Here the Control_type(NLGEOM) has the value 5, which means that the transformation gradient is passed a a kinematical loading path in the file. The simulation therefore consists in a simple shear up to a shear transformation of 5.0 time is set to 5 seconds, with 100 increments, so that time matches the value of the shear transformation. .. GENERATED FROM PYTHON SOURCE LINES 61-71 .. code-block:: Python from pathlib import Path this_dir = Path(os.getcwd()) data_file = this_dir / path_data / pathfile print(f"----- Contents of {data_file.name} -----") print(data_file.read_text().strip()) print("----------------------------------------") .. rst-class:: sphx-glr-script-out .. code-block:: none ----- Contents of path.txt ----- #Initial_temperature 290 #Number_of_blocks 1 #Block 1 #Loading_type 1 #Control_type(NLGEOM) 5 #Repeat 1 #Steps 1 #Mode 1 #Dn_init 1. #Dn_mini 0.1 #Dn_inc 0.001 #time 5. #prescribed_mechanical_state 1 5 0 0 1 0 0 0 1 #prescribed_temperature_state T 290 ---------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 72-73 Next is a loop over the different objective rates where the simulation is run .. GENERATED FROM PYTHON SOURCE LINES 73-116 .. code-block:: Python fig, axes = plt.subplots(2, 2, figsize=(18, 10)) plot_info = [ (0, 0, "e11", r"Strain ($\varepsilon_{11}$)"), (0, 1, "e12", r"Strain ($\varepsilon_{12}$)"), (1, 0, "e22", r"Strain ($\varepsilon_{22}$)"), (1, 1, "rotation", r"rotation angle (rad)"), ] for i, rate_name in enumerate(rate): corate_type = i outputfile = f"results_ELISO_{i}.txt" sim.solver( umat_name, props, nstatev, psi_rve, theta_rve, phi_rve, solver_type, corate_type, path_data, path_results, pathfile, outputfile, ) outputfile_macro = os.path.join( dir, path_results, f"results_ELISO_{i}_global-0.txt" ) data = np.loadtxt(outputfile_macro, unpack=True) time = data[4] e11, e22, e12 = data[8], data[9], data[11] r11 = np.minimum(data[20], 1.0) values = [e11, e12, e22, np.arccos(r11)] for ax_idx, (row, col, _, ylabel) in enumerate(plot_info): axes[row, col].plot(time, values[ax_idx], c=colors[i], label=rate_name) for row, col, _, ylabel in plot_info: axes[row, col].set_xlabel(r"Time (s)", size=15) axes[row, col].set_ylabel(ylabel, size=15) axes[row, col].legend(loc=2) axes[row, col].grid(True) .. image-sg:: /examples/analysis/images/sphx_glr_objective_rates_001.png :alt: objective rates :srcset: /examples/analysis/images/sphx_glr_objective_rates_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 117-126 Note that the Jaumann rate exhibits spurious oscillations in the stress and strain response, while the Green-Naghdi and Logarithmic rates provide smooth responses. This is a well-known issue with the Jaumann rate when dealing with large simple shear transformation. The Green-Naghdi and Logarithmic rates do not suffer from this problem, making them more suitable for simulations involving large deformations and rotations. While logarithmic rates are often considered the most accurate for large deformations, please note that the induced rotation is however not correct. Only the Green-Naghdi rate provides the exact rotation for rigid body motions corresponding to the RU (or VR) decomposition. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.855 seconds) .. _sphx_glr_download_examples_analysis_objective_rates.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: objective_rates.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: objective_rates.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: objective_rates.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_