Note
Go to the end to download the full example code.
Isotropic elasticity (thermomechanical)
import os
import numpy as np
import simcoon as sim
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (18, 10)
In thermoelastic isotropic materials three mechanical parameters and two thermal parameters are required:
The density \(\rho\)
The specific heat \(c_p\)
The Young modulus \(E\)
The Poisson ratio \(\nu\)
The coefficient of thermal expansion \(\alpha\)
The elastic stiffness tensor is written in the Voigt notation formalism as
with
The increment of the elastic strain is given by
In the thermomechanical framework, the thermal work terms \(W_t\), \(W_t^r\) and \(W_t^{ir}\) are also computed alongside the mechanical work terms.
umat_name = "ELISO" # 5 character code for the elastic-isotropic subroutine
nstatev = 1 # Number of internal variables
# Material parameters
rho = 4.4 # Density
c_p = 0.656 # Specific heat capacity
E = 70000.0 # Young's modulus (MPa)
nu = 0.2 # Poisson ratio
alpha = 1.0e-5 # Thermal expansion coefficient
psi_rve = 0.0
theta_rve = 0.0
phi_rve = 0.0
solver_type = 0
corate_type = 2
props = np.array([rho, c_p, E, nu, alpha])
path_data = "../data"
pathfile = "THERM_ELISO_path.json"
The loading path is read in Python and the simulation runs in memory: no result file is written. A thermomechanical run also carries the heat flux, the heat source and the thermal work terms.
blocks, T_init, _ = sim.solver.load_path_json(os.path.join(path_data, pathfile))
res = sim.solver.solve(
blocks,
umat_name,
props,
nstatev,
T_init=T_init,
solver_type=solver_type,
corate=corate_type,
orientation=(psi_rve, theta_rve, phi_rve),
)
Plotting the results
We plot the stress-strain curve, the temperature evolution, the mechanical work terms and the thermal work terms.
fig = plt.figure()
# Get the data
e11, e22, e33, e12, e13, e23 = res["Strain"]
s11, s22, s33, s12, s13, s23 = res["Stress"]
time, T, Q, r = res["Time"], res["Temp"], res["Q"], res["r"]
Wm, Wm_r, Wm_ir, Wm_d = res["Wm"]
Wt, Wt_r, Wt_ir = res["Wt"]
# Stress vs Strain
ax = fig.add_subplot(2, 2, 1)
plt.grid(True)
plt.tick_params(axis="both", which="major", labelsize=15)
plt.xlabel(r"Strain $\varepsilon_{11}$", size=15)
plt.ylabel(r"Stress $\sigma_{11}$ (MPa)", size=15)
plt.plot(e11, s11, c="black", label="direction 1")
plt.legend(loc="best")
# Temperature vs Time
ax = fig.add_subplot(2, 2, 2)
plt.grid(True)
plt.tick_params(axis="both", which="major", labelsize=15)
plt.xlabel("time (s)", size=15)
plt.ylabel(r"Temperature $\theta$ (K)", size=15)
plt.plot(time, T, c="black", label="temperature")
plt.legend(loc="best")
# Mechanical work vs Time
ax = fig.add_subplot(2, 2, 3)
plt.grid(True)
plt.tick_params(axis="both", which="major", labelsize=15)
plt.xlabel("time (s)", size=15)
plt.ylabel(r"$W_m$", size=15)
plt.plot(time, Wm, c="black", label=r"$W_m$")
plt.plot(time, Wm_r, c="green", label=r"$W_m^r$")
plt.plot(time, Wm_ir, c="blue", label=r"$W_m^{ir}$")
plt.plot(time, Wm_d, c="red", label=r"$W_m^d$")
plt.legend(loc="best")
# Thermal work vs Time
ax = fig.add_subplot(2, 2, 4)
plt.grid(True)
plt.tick_params(axis="both", which="major", labelsize=15)
plt.xlabel("time (s)", size=15)
plt.ylabel(r"$W_t$", size=15)
plt.plot(time, Wt, c="black", label=r"$W_t$")
plt.plot(time, Wt_r, c="green", label=r"$W_t^r$")
plt.plot(time, Wt_ir, c="blue", label=r"$W_t^{ir}$")
plt.legend(loc="best")
plt.show()

Total running time of the script: (0 minutes 0.247 seconds)