def setUp(self): string_rep = '<test_j2iso type="SmallStrainRateIndependentPlasticity"><elastic type="IsotropicLinearElasticModel"><m1>103561.64383561644</m1><m1_type>youngs</m1_type><m2>0.2945205479452055</m2><m2_type>poissons</m2_type></elastic><flow type="RateIndependentAssociativeFlow"><surface type="IsoJ2"/><hardening type="LinearIsotropicHardeningRule"><s0>100.0</s0><K>1000.0</K></hardening></flow></test_j2iso>' self.model1 = parse.parse_string(string_rep) mu = 40000.0 K = 84000.0 ys = 100.0 H = 1000.0 elastic = elasticity.IsotropicLinearElasticModel( mu, "shear", K, "bulk") surface = surfaces.IsoJ2() hrule = hardening.LinearIsotropicHardeningRule(ys, H) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model2 = models.SmallStrainRateIndependentPlasticity( elastic, flow) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100 self.emax = np.array([0.1, 0, 0, 0, 0, 0])
def verify_Cg(): E = 30000.0 nu = 0.3 sy = 100.0 Q = 0.0 b = 0.0 C = 1000.0 g = 10.0 mu = E / (2 * (1.0 + nu)) K = E / (3 * (1 - 2 * nu)) elastic = elasticity.IsotropicLinearElasticModel(mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.VoceIsotropicHardeningRule(sy, Q, b) hrule = hardening.Chaboche(iso, [C], [hardening.ConstantGamma(g)], [0.0], [1.0]) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hrule) model = models.SmallStrainRateIndependentPlasticity(elastic, flow, verbose=False) res = drivers.strain_cyclic(model, 0.4, -1.0, 1.0e-4, 1) strain = res['strain'] stress = res['stress'] mv = np.max(np.abs(stress)) hu = mv - sy print("C/y: %f / %f" % ((C / g), hu))
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_nonassri") mu = 40000.0 K = 84000.0 ys = 100.0 r = 100.0 d = 1000.0 cs = [5.0, 10.0] gs = [1000.0, 1000.0] As = [0.0, 0.0] ns = [1.0, 1.0] elastic = elasticity.IsotropicLinearElasticModel( mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.VoceIsotropicHardeningRule(ys, r, d) gammas = [hardening.ConstantGamma(g) for g in gs] hmodel = hardening.Chaboche(iso, cs, gammas, As, ns) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hmodel) self.model2 = models.SmallStrainRateIndependentPlasticity( elastic, flow) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100 self.emax = np.array([0.05, 0, 0, 0, 0, 0])
def setUp(self): self.hist0 = np.zeros((7, )) self.E = 92000.0 self.nu = 0.3 self.mu = self.E / (2 * (1 + self.nu)) self.K = self.E / (3 * (1 - 2 * self.nu)) self.s0 = 180.0 self.R = 150.0 self.d = 10.0 self.elastic = elasticity.IsotropicLinearElasticModel( self.mu, "shear", self.K, "bulk") surface = surfaces.IsoJ2() hrule = hardening.VoceIsotropicHardeningRule(self.s0, self.R, self.d) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model = models.SmallStrainRateIndependentPlasticity( self.elastic, flow, check_kt=False) self.efinal = np.array([0.1, -0.05, 0.02, -0.03, 0.1, -0.15]) self.tfinal = 10.0 self.T = 300.0 self.nsteps = 10
def setUp(self): E = 200000.0 nu = 0.27 mu = E / (2 * (1.0 + nu)) K = E / (3 * (1 - 2 * nu)) s0 = 300.0 Kp = 0.0 c = [30000.0] r = [60.0] A = [0.0] n = [1.0] elastic = elasticity.IsotropicLinearElasticModel( mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(s0, Kp) gmodels = [hardening.ConstantGamma(g) for g in r] hrule = hardening.Chaboche(iso, c, gmodels, A, n) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hrule) self.model = models.SmallStrainRateIndependentPlasticity( elastic, flow, verbose=False, check_kt=False) self.umodel = uniaxial.UniaxialModel(self.model) self.de = 0.001 self.dt = 1.0 self.dT = 0.0 self.T0 = 0.0 self.nsteps = 100
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_creep_plasticity") A = 1.85e-10 n = 2.5 smodel = creep.PowerLawCreep(A, n) cmodel = creep.J2CreepModel(smodel) E = 150000.0 nu = 0.3 sY = 200.0 H = E / 50.0 elastic = elasticity.IsotropicLinearElasticModel( E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() iso = hardening.LinearIsotropicHardeningRule(sY, H) flow = ri_flow.RateIndependentAssociativeFlow(surface, iso) pmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) self.model2 = models.SmallStrainCreepPlasticity( elastic, pmodel, cmodel) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100.0 self.emax = np.array([0.1, 0, 0, 0, 0, 0])
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_j2comb") mu = 40000.0 K = 84000.0 ys = 100.0 r = 100.0 d = 1000.0 KH = 1000.0 elastic = elasticity.IsotropicLinearElasticModel( mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.VoceIsotropicHardeningRule(ys, r, d) kin = hardening.LinearKinematicHardeningRule(KH) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model2 = models.SmallStrainRateIndependentPlasticity( elastic, flow) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100.0 self.emax = np.array([0.1, 0, 0, 0, 0, 0])
def complete(self): self.E = 92000.0 self.nu = 0.3 self.s0 = 180.0 self.Kp = 1000.0 self.H = 1000.0 self.elastic = elasticity.IsotropicLinearElasticModel(self.E, "youngs", self.nu, "poissons") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(self.s0, self.Kp) kin = hardening.LinearKinematicHardeningRule(self.H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.bmodel = models.SmallStrainRateIndependentPlasticity(self.elastic, flow) self.xi = 0.478 self.phi = 1.914 self.A = 10000000.0 self.model = damage.ModularCreepDamageModel_sd( self.elastic, self.A, self.xi, self.phi, self.effective_model(), self.bmodel) self.stress = np.array([100,-50.0,300.0,-99,50.0,125.0]) self.T = 100.0 self.s_np1 = self.stress self.s_n = np.array([-25,150,250,-25,-100,25]) self.d_np1 = 0.5 self.d_n = 0.4 self.e_np1 = np.array([0.1,-0.01,0.15,-0.05,-0.1,0.15]) self.e_n = np.array([-0.05,0.025,-0.1,0.2,0.11,0.13]) self.T_np1 = self.T self.T_n = 90.0 self.t_np1 = 1.0 self.t_n = 0.0 self.u_n = 0.0 self.p_n = 0.0 # This is a rather boring baseline history state to probe, but I can't # think of a better way to get a "generic" history from a generic model self.hist_n = np.array([self.d_n] + list(self.bmodel.init_store())) self.x_trial = np.array([50,-25,150,-150,190,100.0] + [0.41]) self.nsteps = 10 self.etarget = np.array([0.1,-0.025,0.02,0.015,-0.02,-0.05]) self.ttarget = 10.0
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_j2isocomb") E = 150000.0 nu = 0.3 ys = 100.0 H = 100.0 r = 100.0 d = 1000.0 elastic = elasticity.IsotropicLinearElasticModel( E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() hrule1 = hardening.LinearIsotropicHardeningRule(ys, H) hrule2 = hardening.VoceIsotropicHardeningRule(0.0, r, d) hrule = hardening.CombinedIsotropicHardeningRule([hrule1, hrule2]) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model2 = models.SmallStrainRateIndependentPlasticity( elastic, flow) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100.0 self.emax = np.array([0.1, 0, 0, 0, 0, 0])
def setUp(self): self.hist0 = np.zeros((13, )) self.A = 1.85e-10 self.n = 2.5 self.smodel = creep.PowerLawCreep(self.A, self.n) self.cmodel = creep.J2CreepModel(self.smodel) self.E = 150000.0 self.nu = 0.3 self.sY = 200.0 self.H = self.E / 50.0 self.elastic = elasticity.IsotropicLinearElasticModel( self.E, "youngs", self.nu, "poissons") self.surface = surfaces.IsoJ2() self.iso = hardening.LinearIsotropicHardeningRule(self.sY, self.H) self.flow = ri_flow.RateIndependentAssociativeFlow( self.surface, self.iso) self.pmodel = models.SmallStrainRateIndependentPlasticity( self.elastic, self.flow) self.model = models.SmallStrainCreepPlasticity(self.elastic, self.pmodel, self.cmodel) self.efinal = np.array([0.1, -0.05, 0.02, -0.03, 0.1, -0.15]) self.tfinal = 10.0 self.T = 300.0 self.nsteps = 10
def setUp(self): self.hist0 = np.zeros((13, )) self.E = 92000.0 self.nu = 0.3 self.mu = self.E / (2 * (1 + self.nu)) self.K = self.E / (3 * (1 - 2 * self.nu)) self.s0 = 180.0 self.Kp = 1000.0 self.H = 1000.0 self.elastic = elasticity.IsotropicLinearElasticModel( self.mu, "shear", self.K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(self.s0, self.Kp) kin = hardening.LinearKinematicHardeningRule(self.H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model = models.SmallStrainRateIndependentPlasticity( self.elastic, flow) self.efinal = np.array([0.1, -0.05, 0.02, -0.03, 0.1, -0.15]) self.tfinal = 10.0 self.T = 300.0 self.nsteps = 10
def example4(): # T is in hours, strain in percent, stress in MPa A = 1.85e-10 n = 2.5 m = 0.3 smodel = creep.PowerLawCreep(A, n) cmodel = creep.J2CreepModel(smodel) E = 150000.0 nu = 0.3 sY = 200.0 H = E / 25.0 elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() iso = hardening.LinearIsotropicHardeningRule(sY, H) flow = ri_flow.RateIndependentAssociativeFlow(surface, iso) pmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) model = models.SmallStrainCreepPlasticity(elastic, pmodel, cmodel) res = drivers.creep(model, 205.0, 3600.0, 100.0, verbose = False, nsteps_up = 500) plt.plot(res['strain'], res['stress']) plt.show()
def setUp(self): self.E = 92000.0 self.nu = 0.3 self.s0 = 180.0 self.Kp = 1000.0 self.H = 1000.0 self.elastic = elasticity.IsotropicLinearElasticModel(self.E, "youngs", self.nu, "poissons") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(self.s0, self.Kp) kin = hardening.LinearKinematicHardeningRule(self.H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.bmodel = models.SmallStrainRateIndependentPlasticity(self.elastic, flow) self.fn = interpolate.PolynomialInterpolate([-6.653e-9,2.952e-4,-6.197e-1]) self.C = 32.06 self.lmr = larsonmiller.LarsonMillerRelation(self.fn, self.C) self.effective = damage.VonMisesEffectiveStress() self.model = damage.LarsonMillerCreepDamageModel_sd( self.elastic, self.lmr, self.effective, self.bmodel) self.stress = np.array([100,-50.0,300.0,-99,50.0,125.0]) self.T = 100.0 self.s_np1 = self.stress self.s_n = np.array([-25,150,250,-25,-100,25]) self.d_np1 = 0.5 self.d_n = 0.4 self.e_np1 = np.array([0.1,-0.01,0.15,-0.05,-0.1,0.15]) self.e_n = np.array([-0.05,0.025,-0.1,0.2,0.11,0.13]) self.T_np1 = self.T self.T_n = 90.0 self.t_np1 = 1.0 self.t_n = 0.0 self.dt = self.t_np1 - self.t_n self.u_n = 0.0 self.p_n = 0.0 # This is a rather boring baseline history state to probe, but I can't # think of a better way to get a "generic" history from a generic model self.hist_n = np.array([self.d_n] + list(self.bmodel.init_store())) self.x_trial = np.array([50,-25,150,-150,190,100.0] + [0.41]) self.nsteps = 10 self.etarget = np.array([0.1,-0.025,0.02,0.015,-0.02,-0.05]) self.ttarget = 10.0
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_powerdamage") E = 92000.0 nu = 0.3 s0 = 180.0 Kp = 1000.0 elastic = elasticity.IsotropicLinearElasticModel( E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() hrule = hardening.LinearIsotropicHardeningRule(s0, Kp) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) bmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) a = 2.2 A = 2e-5 self.model2 = damage.NEMLPowerLawDamagedModel_sd(elastic, A, a, bmodel) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100.0 self.emax = np.array([0.05, 0, 0, 0, 0, 0])
def verify_warp3d(): E = 30000.0 nu = 0.3 sy = 100.0 Q = 50.0 b = 100.0 C = 1000.0 g = 10.0 mu = E / (2 * (1.0 + nu)) K = E / (3 * (1 - 2 * nu)) elastic = elasticity.IsotropicLinearElasticModel(mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.VoceIsotropicHardeningRule(sy, Q, b) hrule = hardening.Chaboche(iso, [C], [hardening.ConstantGamma(g)], [0.0], [1.0]) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hrule) model = models.SmallStrainRateIndependentPlasticity(elastic, flow, verbose=False) res = drivers.strain_cyclic(model, 0.0075, -1.0, 1.0e-4, 50) strain = res['strain'] stress = res['stress'] data_warp = np.load('data_fa_warp.npy') plt.plot(strain, stress, 'k-') plt.plot(data_warp[0], data_warp[1], 'r-') plt.show()
def verify_Q(): E = 30000.0 nu = 0.3 sy = 100.0 Q = 50.0 b = 100.0 C = 0.0 g = 0.0 mu = E / (2 * (1.0 + nu)) K = E / (3 * (1 - 2 * nu)) elastic = elasticity.IsotropicLinearElasticModel(mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.VoceIsotropicHardeningRule(sy, Q, b) gmodels = [hardening.ConstantGamma(g)] hrule = hardening.Chaboche(iso, [C], gmodels, [0.0], [1.0]) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hrule) model = models.SmallStrainRateIndependentPlasticity(elastic, flow, verbose=False) res = drivers.uniaxial_test(model, 1.0e-2, emax=0.2) stress = res['stress'] print("Q: %f / %f" % (Q, stress[-1] - sy))
def simple_ex(): E = 92000.0 nu = 0.3 s0 = 180.0 Kp = 1000.0 H = 1000.0 elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(s0, Kp) kin = hardening.LinearKinematicHardeningRule(H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) bmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) A = 0.0e-6 a = 2.2 model_off = damage.NEMLPowerLawDamagedModel_sd(elastic, A, a, bmodel) A = 2e-5 model_on = damage.NEMLPowerLawDamagedModel_sd(elastic, A, a, bmodel) res_off = drivers.uniaxial_test(model_off, 1.0e-2, emax=0.13) res_on = drivers.uniaxial_test(model_on, 1.0e-2, emax=0.13) plt.plot(res_off['strain'], res_off['stress'], 'k-') plt.plot(res_on['strain'], res_on['stress'], 'r-') plt.show()
def setUp(self): self.E = 100000.0 self.nu = 0.29 self.sY = 100.0 self.H = 1200.0 elastic = elasticity.IsotropicLinearElasticModel( self.E, "youngs", self.nu, "poissons") surf = surfaces.IsoJ2() hard = hardening.LinearIsotropicHardeningRule(self.sY, self.H) flow = ri_flow.RateIndependentAssociativeFlow(surf, hard) self.model = models.SmallStrainRateIndependentPlasticity(elastic, flow) self.conditions = [{ 'hist_n': self.model.init_store(), 'stress_n': np.zeros((6, )), 'd_n': np.zeros((6, )), 'd_np1': np.array([0.1, 0.05, -0.025, 0.15, 0.2, -0.05]), 'w_n': np.zeros((3, )), 'w_np1': np.array([-0.15, 0.1, 0.05]), 'dt': 1.0, 'T': 300.0 }, { 'hist_n': self.model.init_store(), 'stress_n': np.array([10.0, -5.0, 30.0, -5.0, 10.0, 15.0]), 'd_n': np.zeros((6, )), 'd_np1': np.array([0.05, 0.5, 0.25, 0.20, -0.2, 0.25]), 'w_n': np.zeros((3, )), 'w_np1': np.array([-0.15, 0.25, 0.05]), 'dt': 1.0, 'T': 300.0 }] self.directions = [{ 'd': np.array([0.1, -0.15, 0.2, -0.05, 0.15, 0.25]), 'w': np.array([0.25, -0.15, 0.1]) }] self.nsteps = 10 self.dt = 1.0 self.T = 300.0
def unload_ex(): E = 92000.0 nu = 0.3 s0 = 180.0 Kp = 1000.0 H = 1000.0 elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(s0, Kp) kin = hardening.LinearKinematicHardeningRule(H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) bmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) A = 2e-5 a = 2.2 model = damage.NEMLPowerLawDamagedModel_sd(elastic, A, a, bmodel) driver = drivers.Driver_sd(model) nsteps = 25 sdir = np.array([1, 0, 0, 0, 0, 0]) erate = 1.0e-5 e_inc = 0.1 / nsteps for i in range(nsteps): einc, ainc = driver.erate_einc_step(sdir, erate, e_inc, 0.0) estrain = model.elastic_strains(driver.stress_int[-1], driver.T_int[-1], driver.stored[-1]) print("Calculated elastic strain: %f" % estrain[0]) nsteps = 20 dt = 0.1 rstress = driver.stress_int[-1] rstrain = driver.strain_int[-1][0] for m in np.linspace(0, 1.0, nsteps, endpoint=False)[::-1]: driver.stress_step(rstress * m, driver.t_int[-1] + dt, driver.T_int[-1]) fstrain = driver.strain_int[-1][0] print("Actual elastic strain: %f" % (rstrain - fstrain)) print("Calculated final elastic strain: %f" % model.elastic_strains( driver.stress_int[-1], driver.T_int[-1], driver.stored[-1])[0]) plt.plot(driver.strain[:, 0], driver.stress[:, 0]) plt.show()
def test_ri_plasticity(self): surface = surfaces.IsoJ2() sy = 100.0 K = 1000.0 H = 500.0 hrule = hardening.CombinedHardeningRule( hardening.LinearIsotropicHardeningRule(sy, K), hardening.LinearKinematicHardeningRule(H)) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) model = models.SmallStrainRateIndependentPlasticity( self.elastic1, flow) self.are_equal(self.elastic1, model.elastic) model.set_elastic_model(self.elastic2) self.are_equal(self.elastic2, model.elastic)
def creep_ex(): E = 92000.0 nu = 0.3 s0 = 120.0 A = 1.0e-10 n = 3.0 Kp = E / 500 H = E / 500 smodel = creep.PowerLawCreep(A, n) cmodel = creep.J2CreepModel(smodel) elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(s0, Kp) kin = hardening.LinearKinematicHardeningRule(H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) pmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) bmodel = models.SmallStrainCreepPlasticity(elastic, pmodel, cmodel) A_damg = 1.0e-2 a_damg = 1.0 model = damage.NEMLPowerLawDamagedModel_sd(elastic, A_damg, a_damg, bmodel, verbose=False) #res = drivers.uniaxial_test(model, 1.0e-2, emax = 0.25) #plt.plot(res['strain'], res['stress']) #plt.show() res = drivers.creep(model, 120.0, 1.0, 393.0, verbose=False) plt.plot(res['rtime'], res['rstrain']) plt.show() plt.loglog(res['rtime'], res['rrate']) plt.show()
def setUp(self): E = 150000.0 nu = 0.3 ys = 100.0 H = 1000.0 elastic = elasticity.IsotropicLinearElasticModel( E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() hrule = hardening.LinearIsotropicHardeningRule(ys, H) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model = models.SmallStrainRateIndependentPlasticity(elastic, flow) self.nblock = 100
def example3(): # T is in hours, strain in percent, stress in MPa A = 1.85e-10 n = 2.5 smodel = creep.PowerLawCreep(A, n) cmodel = creep.J2CreepModel(smodel) E = 150000.0 nu = 0.3 sY = 200.0 H = E / 50.0 elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() iso = hardening.LinearIsotropicHardeningRule(sY, H) flow = ri_flow.RateIndependentAssociativeFlow(surface, iso) pmodel = models.SmallStrainRateIndependentPlasticity(elastic, flow) smax = 250.0 R = -0.5 srate = 1.0 * 3600.0 ncycles = 25 hold = 25 res1 = drivers.stress_cyclic(pmodel, smax, R, srate, ncycles, hold_time = [0,hold]) model = models.SmallStrainCreepPlasticity(elastic, pmodel, cmodel, verbose = False) res2 = drivers.stress_cyclic(model, smax, R, srate, ncycles, hold_time = [0,hold], verbose = False) plt.plot(res1['strain'], res1['stress'], 'k-') plt.plot(res2['strain'], res2['stress'], 'r-') plt.show()
def setUp(self): self.model1 = parse.parse_xml("test/examples.xml", "test_j2iso") mu = 40000.0 K = 84000.0 ys = 100.0 H = 1000.0 elastic = elasticity.IsotropicLinearElasticModel( mu, "shear", K, "bulk") surface = surfaces.IsoJ2() hrule = hardening.LinearIsotropicHardeningRule(ys, H) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.model2 = models.SmallStrainRateIndependentPlasticity( elastic, flow) self.T = 300.0 self.tmax = 10.0 self.nsteps = 100.0 self.emax = np.array([0.1, 0, 0, 0, 0, 0])
def test_damage(self): s0 = 180.0 Kp = 1000.0 H = 1000.0 surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(s0, Kp) kin = hardening.LinearKinematicHardeningRule(H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) bmodel = models.SmallStrainRateIndependentPlasticity( self.elastic1, flow) W0 = 10.0 k0 = 0.0001 a0 = 2.0 model1 = damage.NEMLExponentialWorkDamagedModel_sd( self.elastic1, W0, k0, a0, bmodel) W02 = 10.0 k02 = 0.001 a02 = 1.5 model2 = damage.NEMLExponentialWorkDamagedModel_sd( self.elastic1, W02, k02, a02, bmodel) model = damage.CombinedDamageModel_sd(self.elastic1, [model1, model2], bmodel) self.very_close(model, self.emodel1) model.set_elastic_model(self.elastic2) self.very_close(model, self.emodel2)
def setUp(self): self.hist0 = np.zeros((13, )) self.E = 92000.0 self.nu = 0.3 self.mu = self.E / (2 * (1 + self.nu)) self.K = self.E / (3 * (1 - 2 * self.nu)) self.s0 = 180.0 self.Kp = 1000.0 self.n = 2 self.cs = [10.0, 2.0] self.rs = [5.0, 1.0] self.gmodels = [hardening.ConstantGamma(g) for g in self.rs] self.As = [0.0] * self.n self.ns = [1.0] * self.n self.elastic = elasticity.IsotropicLinearElasticModel( self.mu, "shear", self.K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(self.s0, self.Kp) hmodel = hardening.Chaboche(iso, self.cs, self.gmodels, self.As, self.ns) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hmodel) self.model = models.SmallStrainRateIndependentPlasticity( self.elastic, flow, check_kt=False) self.efinal = np.array([0.1, -0.05, 0.02, -0.03, 0.1, -0.15]) self.tfinal = 10.0 self.T = 300.0 self.nsteps = 30
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
from neml import solvers, models, elasticity, drivers, surfaces, hardening, ri_flow, parse import matplotlib.pyplot as plt import numpy as np if __name__ == "__main__": E = 100000.0 nu = 0.3 s0 = 100.0 A = 200.0 n = 0.2 elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") surface = surfaces.IsoJ2() iso = hardening.PowerLawIsotropicHardeningRule(s0, A, n) flow = ri_flow.RateIndependentAssociativeFlow(surface, iso) model = models.SmallStrainRateIndependentPlasticity(elastic, flow) model2 = parse.parse_xml("example.xml", "powerlaw") erate = 1.0 res = drivers.uniaxial_test(model, erate, emax=0.1) res2 = drivers.uniaxial_test(model2, erate, emax=0.1) plt.plot(res['strain'], res['stress']) plt.plot(res2['strain'], res2['stress'], ls='--') plt.show()
Kp = 0.0 c = [30000.0] r = [60.0] elastic = elasticity.IsotropicLinearElasticModel(mu, "shear", K, "bulk") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(s0, Kp) gmodels = [hardening.ConstantGamma(g) for g in r] As = [0.0] ns = [1.0] hrule = hardening.Chaboche(iso, c, gmodels, As, ns) flow = ri_flow.RateIndependentNonAssociativeHardening(surface, hrule) model = models.SmallStrainRateIndependentPlasticity(elastic, flow, verbose=False, check_kt=False) # Uniaxial stress/strain curves at decades of strain rates erates = np.logspace(-6, 2, 9) for rate in erates: res = drivers.uniaxial_test(model, rate) plt.plot(res['strain'], res['stress']) plt.xlabel("Strain (-/-)") plt.ylabel("Stress (MPa)") plt.show() # A strain-controlled cyclic test res = drivers.strain_cyclic(model, 0.01, -0.25, 1.0e-4, 50) plt.plot(res['strain'], res['stress'], 'k-')
def setUp(self): self.E = 92000.0 self.nu = 0.3 self.s0 = 180.0 self.Kp = 1000.0 self.H = 1000.0 self.elastic = elasticity.IsotropicLinearElasticModel(self.E, "youngs", self.nu, "poissons") surface = surfaces.IsoKinJ2() iso = hardening.LinearIsotropicHardeningRule(self.s0, self.Kp) kin = hardening.LinearKinematicHardeningRule(self.H) hrule = hardening.CombinedHardeningRule(iso, kin) flow = ri_flow.RateIndependentAssociativeFlow(surface, hrule) self.bmodel = models.SmallStrainRateIndependentPlasticity(self.elastic, flow) self.fn = interpolate.PolynomialInterpolate([0.1,5.0, 1e-8]) self.n = 2.1 self.model = damage.NEMLWorkDamagedModel_sd( self.elastic, self.fn, self.n, self.bmodel, verbose = False) self.stress = np.array([100,-50.0,300.0,-99,50.0,125.0]) * 0.75 self.T = 100.0 self.s_np1 = self.stress self.s_n = np.array([-25,150,250,-25,-100,25]) * 0.0 self.d_np1 = 0.2 self.d_n = 0.1 self.e_np1 = np.array([0.1,-0.01,0.15,-0.05,-0.1,0.15]) * 0.75 self.e_n = np.array([-0.05,0.025,-0.1,0.2,0.11,0.13]) * 0.0 self.T_np1 = self.T self.T_n = 90.0 self.t_np1 = 5000.0 self.t_n = 0.9 self.u_n = 0.0 self.p_n = 0.0 # This is a rather boring baseline history state to probe, but I can't # think of a better way to get a "generic" history from a generic model self.hist_n = np.array([self.d_n] + list(self.bmodel.init_store())) self.x_trial = np.array([50,-25,150,-150,190,100.0] + [0.41]) self.nsteps = 10 self.etarget = np.array([0.1,-0.025,0.02,0.015,-0.02,-0.05]) self.ttarget = 2.0 self.ee = np.dot(self.elastic.S(self.T_np1), self.s_np1*(1.0-self.d_np1) - self.s_n*(1.0-self.d_n)) self.de = self.e_np1 - self.e_n self.dp = self.de - self.ee self.dt = self.t_np1 - self.t_n self.Wdot = np.dot(self.s_np1*(1.0-self.d_np1), self.dp) / self.dt