def setUp(self): self.validx = [-10.0, -2.0, 1.0, 2.0, 5.0, 15.0] self.invalidx_1 = [-2.0, -10.0, 1.0, 2.0, 5.0, 15.0] self.invalidx_2 = [-10.0, -2.0, 1.0, 2.0, 5.0] self.points = [50.0, -25.0, 1.0, 0.0, 0.0, 10.0] self.x = 17.0 self.valid = interpolate.PiecewiseLinearInterpolate( self.validx, self.points) self.invalid1 = interpolate.PiecewiseLinearInterpolate( self.invalidx_1, self.points) self.invalid2 = interpolate.PiecewiseLinearInterpolate( self.invalidx_2, self.points) self.interpolate = self.valid
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_pcreep") E = [-100, 100000] nu = 0.3 youngs = interpolate.PolynomialInterpolate(E) poissons = interpolate.ConstantInterpolate(nu) elastic = elasticity.IsotropicLinearElasticModel( youngs, "youngs", poissons, "poissons") surface = surfaces.IsoJ2() Ts = [100.0, 300.0, 500.0, 700.0] Sys = [1000.0, 120.0, 60.0, 30.0] yields = interpolate.PiecewiseLinearInterpolate(Ts, Sys) pmodel = models.SmallStrainPerfectPlasticity(elastic, surface, yields) self.T = 550.0 self.tmax = 10.0 self.nsteps = 50.0 self.emax = np.array([0.1, 0.05, 0, -0.025, 0, 0]) A = 1.85e-10 n = 2.5 smodel = creep.PowerLawCreep(A, n) cmodel = creep.J2CreepModel(smodel) self.model2 = models.SmallStrainCreepPlasticity( elastic, pmodel, cmodel)
def setUp(self): self.model1 = parse.parse_xml(localize("examples.xml"), "test_perfect") E = [-100, 100000] nu = 0.3 youngs = interpolate.PolynomialInterpolate(E) poissons = interpolate.ConstantInterpolate(nu) elastic = elasticity.IsotropicLinearElasticModel( youngs, "youngs", poissons, "poissons") surface = surfaces.IsoJ2() Ts = [100.0, 300.0, 500.0, 700.0] Sys = [1000.0, 120.0, 60.0, 30.0] yields = interpolate.PiecewiseLinearInterpolate(Ts, Sys) self.model2 = models.SmallStrainPerfectPlasticity( elastic, surface, yields) self.T = 550.0 self.tmax = 10.0 self.nsteps = 50 self.emax = np.array([0.1, 0.05, 0, -0.025, 0, 0])
def setUp(self): s0 = 200.0 K = 1000.0 self.n = 2 cvals1 = [1000.0, 10.0] cvals2 = [100.0, 100.0] Ts = [0.0, 1000.0] cs = [ interpolate.PiecewiseLinearInterpolate(Ts, [ci, cj]) for ci, cj in zip(cvals1, cvals2) ] rs = [1.0e-2, 1.0] gammas = [hardening.ConstantGamma(r) for r in rs] self.As = [0.0] * self.n self.ns = [1.0] * self.n iso = hardening.LinearIsotropicHardeningRule(s0, K) self.model = hardening.Chaboche(iso, cs, gammas, self.As, self.ns) self.hist0 = np.zeros((1 + self.n * 6, )) self.conform = 7 self.T = 300.0
def setUp(self): self.points = [0.0, 0.01, 0.02, 0.05] self.values = [100.0, 110.0, 130.0, 135.0] self.ifn = interpolate.PiecewiseLinearInterpolate(self.points, self.values) self.hist0 = np.array([0.0]) self.hist_trial = np.array([0.03]) self.T = 300.0 self.model = hardening.InterpolatedIsotropicHardeningRule(self.ifn)
def setUp(self): self.model = creep.MinCreep225Cr1MoCreep() self.T = 600 + 273.15 self.e = 0.1 self.s = 100.0 self.t = 10.0 self.U = interpolate.PiecewiseLinearInterpolate( [371, 400, 450, 500, 550, 600, 621, 649], [471,468,452,418,634,284,300,270])
import sys sys.path.append('..') from neml import solvers, models, elasticity, drivers, surfaces, hardening, ri_flow, interpolate import matplotlib.pyplot as plt import numpy as np if __name__ == "__main__": E = 200000.0 nu = 0.27 points = [0.0, 0.01, 0.02, 0.045] values = [100.0, 150.0, 160.0, 170.0] elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() ifn = interpolate.PiecewiseLinearInterpolate(points, values) iso = hardening.InterpolatedIsotropicHardeningRule(ifn) flow = ri_flow.RateIndependentAssociativeFlow(surface, iso) model = models.SmallStrainRateIndependentPlasticity(elastic, flow) res = drivers.uniaxial_test(model, 1.0e-4, emax=0.045) plt.plot(res['strain'], res['stress'], 'k-') plt.plot(res['strain'] + values[0] / E, [ifn(e) for e in res['strain']], 'r-') plt.xlim([0, 0.05]) plt.ylim([0, 175]) plt.show()
def setUp(self): # Fully-defined perfectly plastic model Epoly = [-78.2759, 236951.0] nu = 0.3 A = -9.6187 B = -1.4819 C = -5.0486 g0 = 0.3708 b = 0.248 * 1.0e-6 kboltz = 1.38064e-23 * 1000.0 eps0 = 1.0e10 # Temperature range over which to consider (K) Tmin = 550.0 Tmax = 950.0 Trange = np.linspace(Tmin, Tmax) # Elastic E_m = interpolate.PolynomialInterpolate(Epoly) nu_m = interpolate.ConstantInterpolate(nu) elastic_m = elasticity.IsotropicLinearElasticModel( E_m, "youngs", nu_m, "poissons") self.elastic = elastic_m # Rate sensitivity interpolates values mu_values = np.array([elastic_m.G(T) for T in Trange]) n_values = -mu_values * b**3.0 / (kboltz * Trange * A) eta_values = np.exp(B) * eps0**(kboltz * Trange * A / (mu_values * b**3.0)) * mu_values # Rate independent interpolate values flow_stress = mu_values * np.exp(C) # Common objects surface = surfaces.IsoKinJ2() hmodulus = interpolate.PolynomialInterpolate([-10.0, 12000.0]) # Setup visco model n_interp = interpolate.PiecewiseLinearInterpolate( list(Trange), list(n_values)) eta_interp = interpolate.PiecewiseLinearInterpolate( list(Trange), list(eta_values)) eta_m = visco_flow.ConstantFluidity(eta_interp) iso_rd = hardening.LinearIsotropicHardeningRule( interpolate.ConstantInterpolate(0.0), hmodulus) hard_rd = hardening.Chaboche( iso_rd, [interpolate.ConstantInterpolate(0.0)], [hardening.ConstantGamma(interpolate.ConstantInterpolate(0.0))], [interpolate.ConstantInterpolate(0.0)], [interpolate.ConstantInterpolate(1.0)]) visco_rd = visco_flow.ChabocheFlowRule(surface, hard_rd, eta_m, n_interp) general_rd = general_flow.TVPFlowRule(elastic_m, visco_rd) rate_dependent = models.GeneralIntegrator(elastic_m, general_rd) # Setup rate independent sy_interp = interpolate.PiecewiseLinearInterpolate( list(Trange), list(flow_stress)) iso_ri = hardening.LinearIsotropicHardeningRule(sy_interp, hmodulus) hard_ri = hardening.Chaboche( iso_ri, [interpolate.ConstantInterpolate(0.0)], [hardening.ConstantGamma(interpolate.ConstantInterpolate(0.0))], [interpolate.ConstantInterpolate(0.0)], [interpolate.ConstantInterpolate(1.0)]) flow_ri = ri_flow.RateIndependentNonAssociativeHardening( surface, hard_ri) rate_independent = models.SmallStrainRateIndependentPlasticity( elastic_m, flow_ri) # Combined model self.model = models.KMRegimeModel(elastic_m, [rate_independent, rate_dependent], [g0], kboltz, b, eps0) self.efinal = np.array([0.05, 0, 0, 0.02, 0, -0.01]) self.tfinal = 10.0 self.T = 700.0 self.nsteps = 100
elastic_m = elasticity.IsotropicLinearElasticModel(E_m, "youngs", nu_m, "poissons") # Rate sensitivity interpolates Ts_rate = np.linspace(Tmin, Tmax, num=nrate_sens) n_values = [] eta_values = [] flow_stress_values = [] for T in Ts_rate: mu = elastic_m.G(T) n_values.append(-mu * b**3.0 / (kboltz * T * A)) eta_values.append( np.exp(B) * eps0**(kboltz * T * A / (mu * b**3.0)) * mu) flow_stress_values.append(mu * np.exp(C)) n_interp = interpolate.PiecewiseLinearInterpolate(list(Ts_rate), n_values) eta_interp = interpolate.PiecewiseLinearInterpolate( list(Ts_rate), eta_values) eta_m = visco_flow.ConstantFluidity(eta_interp) flow_interp = interpolate.PiecewiseLinearInterpolate( list(Ts_rate), flow_stress_values) iso_rd = hardening.LinearIsotropicHardeningRule(0.0, -K / 10) iso_ri = hardening.LinearIsotropicHardeningRule( flow_interp, interpolate.ConstantInterpolate(-K / 10)) hmodel_rd = hardening.Chaboche(iso_rd, [K * 3.0 / 2.0], [hardening.ConstantGamma(0.0)], [0.0], [1.0]) hmodel_ri = hardening.Chaboche(iso_ri, [K * 3.0 / 2.0], [hardening.ConstantGamma(0.0)], [0.0],
# Rate sensitivity interpolates values mu_values = np.array([elastic_m.G(T) for T in Trange]) n_values = -mu_values * b**3.0 / (kboltz * Trange * A) eta_values = np.exp(B) * eps0**(kboltz * Trange * A / (mu_values * b**3.0)) * mu_values # Rate independent interpolate values flow_stress = mu_values * np.exp(C) # Common objects surface = surfaces.IsoKinJ2() hmodulus = interpolate.PolynomialInterpolate([-10.0, 12000.0]) #hmodulus = interpolate.ConstantInterpolate(1000.0) # Setup visco model n_interp = interpolate.PiecewiseLinearInterpolate(list(Trange), list(n_values)) eta_interp = interpolate.PiecewiseLinearInterpolate( list(Trange), list(eta_values)) eta_m = visco_flow.ConstantFluidity(eta_interp) iso_rd = hardening.LinearIsotropicHardeningRule( interpolate.ConstantInterpolate(0.0), hmodulus) hard_rd = hardening.Chaboche( iso_rd, [interpolate.ConstantInterpolate(0.0)], [hardening.ConstantGamma(interpolate.ConstantInterpolate(0.0))], [interpolate.ConstantInterpolate(0.0)], [interpolate.ConstantInterpolate(1.0)]) visco_rd = visco_flow.ChabocheFlowRule(surface, hard_rd, eta_m, n_interp) general_rd = general_flow.TVPFlowRule(elastic_m, visco_rd)
emodel = elasticity.IsotropicLinearElasticModel( interpolate.PiecewiseLinearInterpolate([ 273.15, 288.741836735, 304.333673469, 319.925510204, 335.517346939, 351.109183673, 366.701020408, 382.292857143, 397.884693878, 413.476530612, 429.068367347, 444.660204082, 460.252040816, 475.843877551, 491.435714286, 507.02755102, 522.619387755, 538.21122449, 553.803061224, 569.394897959, 584.986734694, 600.578571429, 616.170408163, 631.762244898, 647.354081633, 662.945918367, 678.537755102, 694.129591837, 709.721428571, 725.313265306, 740.905102041, 756.496938776, 772.08877551, 787.680612245, 803.27244898, 818.864285714, 834.456122449, 850.047959184, 865.639795918, 881.231632653, 896.823469388, 912.415306122, 928.007142857, 943.598979592, 959.190816327, 974.782653061, 990.374489796, 1005.96632653, 1021.55816327, 1037.15 ], [ 214750.0, 213658.571429, 212587.755102, 211548.29932, 210508.843537, 209469.387755, 208429.931973, 207451.428571, 206515.918367, 205580.408163, 204526.530612, 203279.183673, 202031.836735, 200838.367347, 199902.857143, 198967.346939, 198031.836735, 197096.326531, 196160.816327, 195225.306122, 194053.061224, 192805.714286, 191558.367347, 190311.020408, 189063.673469, 187816.326531, 186568.979592, 185321.632653, 184074.285714, 182826.938776, 181579.591837, 180332.244898, 179084.897959, 177546.938776, 175987.755102, 174428.571429, 172643.265306, 170772.244898, 168901.22449, 166868.571429, 164685.714286, 162502.857143, 160222.857143, 157728.163265, 155233.469388, 152738.77551, 150244.081633, 147749.387755, 145254.693878, 142760.0 ]), "youngs", 0.3, "poissons") bmodel = parse.parse_xml("example.xml", "gr91_simple")