<reponame>JulianKarlBauer/mechmean<filename>docs/source/notebooks/01.py
# # Mori-Tanaka orientation-averaging following Benveniste

import numpy as np
import mechmean
import mechkit
from mechmean.example_input import inp

np.set_printoptions(linewidth=140)

# Define isotropic constituents
inclusion = mechkit.material.Isotropic(E=inp["E_f"], nu=inp["nu_f"])
matrix = mechkit.material.Isotropic(E=inp["E_m"], nu=inp["nu_m"])

# Define orientation averager and polairzation
averager = mechmean.orientation_averager.AdvaniTucker(N4=inp["N4"])
P_func = mechmean.hill_polarization.Factory().needle

# Homogenize
input_dict = {
    "phases": {
        "inclusion": {
            "material": inclusion,
            "volume_fraction": inp["c_f"],
            "hill_polarization": P_func(matrix=matrix),
        },
        "matrix": {"material": matrix},
    },
    "averaging_func": averager.average,
}
mori = mechmean.approximation.MoriTanakaOrientationAveragedBenveniste(**input_dict)
C_eff = mori.calc_C_eff()

print("Effective stiffness Mori-Tanaka orientation averaged Benveniste")
print(C_eff)

# # Mori-Tanaka orientation-averaging following Benveniste

import numpy as np
import mechmean
import mechkit
from mechmean.example_input import inp

np.set_printoptions(linewidth=140)

# Define isotropic constituents
inclusion = mechkit.material.Isotropic(E=inp["E_f"], nu=inp["nu_f"])
matrix = mechkit.material.Isotropic(E=inp["E_m"], nu=inp["nu_m"])

# Define orientation averager and polairzation
averager = mechmean.orientation_averager.AdvaniTucker(N4=inp["N4"])
P_func = mechmean.hill_polarization.Factory().needle

# Homogenize
input_dict = {
    "phases": {
        "inclusion": {
            "material": inclusion,
            "volume_fraction": inp["c_f"],
            "hill_polarization": P_func(matrix=matrix),
        },
        "matrix": {"material": matrix},
    },
    "averaging_func": averager.average,
}
mori = mechmean.approximation.MoriTanakaOrientationAveragedBenveniste(**input_dict)
C_eff = mori.calc_C_eff()

print("Effective stiffness Mori-Tanaka orientation averaged Benveniste")
print(C_eff)
# # Mori-Tanaka orientation-averaging following Benveniste # Define isotropic constituents # Define orientation averager and polairzation # Homogenize