In [1]:
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from simmit import smartplus as sim
from simmit import identify as iden
import os
import itertools
dir = os.path.dirname(os.path.realpath('__file__'))
We need to import here the data, modify them if needed and proceed
In [2]:
umat_name = 'MIMTN' #This is the 5 character code for the Mori-Tanaka homogenization for composites with a matrix and ellipsoidal reinforcments
nstatev = 0
nphases = 2 #The number of phases
num_file = 0 #The num of the file that contains the subphases
int1 = 50
int2 = 50
n_matrix = 0
props = np.array([nphases, num_file, int1, int2, n_matrix])
NPhases_file = dir + '/keys/Nellipsoids0.dat'
NPhases = pd.read_csv(NPhases_file, delimiter=r'\s+', index_col=False, engine='python')
NPhases[::]
Out[2]:
In [3]:
path_data = dir + '/data'
path_keys = dir + '/keys'
pathfile = 'path.txt'
outputfile = 'results_PLN.txt'
nparams = 4
param_list = iden.read_parameters(nparams)
psi_rve = 0.
theta_rve = 0.
phi_rve = 0.
alpha = np.arange(0.,91.,1)
param_list[1].value = 100
param_list[2].value = 0.4
param_list[3].value = 1.0 - param_list[2].value
E_L = np.zeros(len(alpha))
fig = plt.figure()
umat_name = 'MIMTN' #This is the 5 character code for the Mori-Tanaka homogenization for composites with a matrix and ellipsoidal reinforcments
for i, x in enumerate (alpha):
param_list[0].value = x
iden.copy_parameters(param_list, path_keys, path_data)
iden.apply_parameters(param_list, path_data)
L = sim.L_eff(umat_name, props, nstatev, psi_rve, theta_rve, phi_rve, path_data)
p = sim.L_ortho_props(L)
E_L[i] = p[0]
plt.plot(alpha,E_L, c='black')
np.savetxt('E_L-angle_MT.txt', np.transpose([alpha,E_L]), fmt='%1.8e')
umat_name = 'MISCN' #This is the 5 character code for the Mori-Tanaka homogenization for composites with a matrix and ellipsoidal reinforcments
for i, x in enumerate (alpha):
param_list[0].value = x
iden.copy_parameters(param_list, path_keys, path_data)
iden.apply_parameters(param_list, path_data)
L = sim.L_eff(umat_name, props, nstatev, psi_rve, theta_rve, phi_rve, path_data)
p = sim.L_ortho_props(L)
E_L[i] = p[0]
plt.plot(alpha,E_L, c='red')
np.savetxt('E_L-angle_SC.txt', np.transpose([alpha,E_L]), fmt='%1.8e')
plt.show()
Now let's study the evolution of the concentration
In [4]:
param_list[0].value = 0.0
param_list[1].value = 100
c = np.arange(0.,1.01,0.01)
E_L = np.zeros(len(c))
E_T = np.zeros(len(c))
umat_name = 'MIMTN' #This is the 5 character code for the Mori-Tanaka homogenization for composites with a matrix and ellipsoidal reinforcments
for i, x in enumerate (c):
param_list[3].value = x
param_list[2].value = 1.0 - param_list[3].value
iden.copy_parameters(param_list, path_keys, path_data)
iden.apply_parameters(param_list, path_data)
L = sim.L_eff(umat_name, props, nstatev, psi_rve, theta_rve, phi_rve, path_data)
p = sim.L_ortho_props(L)
E_L[i] = p[0]
E_T[i] = p[1]
fig = plt.figure()
np.savetxt('E-concentration_MT.txt', np.transpose([c,E_L,E_T]), fmt='%1.8e')
plt.plot(c,E_L, c='black')
plt.plot(c,E_T, c='black', label='Mori-Tanaka')
umat_name = 'MISCN' #This is the 5 character code for the Mori-Tanaka homogenization for composites with a matrix and ellipsoidal reinforcments
for i, x in enumerate (c):
param_list[3].value = x
param_list[2].value = 1.0 - param_list[3].value
iden.copy_parameters(param_list, path_keys, path_data)
iden.apply_parameters(param_list, path_data)
L = sim.L_eff(umat_name, props, nstatev, psi_rve, theta_rve, phi_rve, path_data)
p = sim.L_ortho_props(L)
E_L[i] = p[0]
E_T[i] = p[1]
np.savetxt('E-concentration_SC.txt', np.transpose([c,E_L,E_T]), fmt='%1.8e')
plt.plot(c,E_L, c='red')
plt.plot(c,E_T, c='red', label='self-consistent')
plt.xlabel('volume fraction $c$', size=12)
plt.ylabel('Young modulus', size=12)
plt.show()
In [ ]: