def shear(): """ Recreate some of the results of Bazant 2013 """ F = lambda t: np.array([[1,t,0],[0,1.0,0],[0,0,1]]) tmax = 10.0 nsteps = 250 G = 100.0 K = 10.0 elastic = elasticity.IsotropicLinearElasticModel(G, "shear", K, "bulk") model = models.SmallStrainElasticity(elastic) res = drivers.def_grad_driver(model, F, tmax, nsteps) theta = [Fi[0,1] / 2.0 for Fi in res['F']] nstress = [Si[5] / G / np.sqrt(2) for Si in res['stress']] plt.plot(theta, nstress, label = "Truesdell") model = models.SmallStrainElasticity(elastic, truesdell = False) res = drivers.def_grad_driver(model, F, tmax, nsteps) theta = [Fi[0,1] / 2.0 for Fi in res['F']] nstress = [Si[5] / G / np.sqrt(2) for Si in res['stress']] plt.plot(theta, nstress, label = "Jaumann") plt.xlabel(r"$\tan\left(\theta\right / 2)$") plt.ylabel(r"$\tau_{12}/G$") plt.legend(loc = 'best') plt.show()
def rotation(): """ Rotate a fixed stress tensor """ def F(t): cut = 1.0 bF = lambda tt: np.array([[1+tt,0,0],[0,1.0-tt/4.0,0],[0,0,1-tt/4.0]]) R = lambda tt: np.array([ [np.cos(tt*(np.pi/2)), -np.sin(tt*(np.pi/2)),0], [np.sin(tt*(np.pi/2)), np.cos(tt*(np.pi/2)),0], [0, 0, 1]]) if t <= cut: F = bF(t) else: F = np.dot(R(t-cut), bF(cut)) return F tmax = 2.0 nsteps = 1000 E = 100.0 nu = 0.25 elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") model = models.SmallStrainElasticity(elastic) res = drivers.def_grad_driver(model, F, tmax, 2*nsteps) print(res['stress'][nsteps]) print(res['stress'][2*nsteps])
def setUp(self): self.ro = 5 self.ri = 4.5 self.h = 2.5 self.nr = 10 self.nt = 20 self.nz = 5 self.E = 150000.0 self.nu = 0.35 self.tube = receiver.Tube(self.ro, self.ro - self.ri, self.h, self.nr, self.nt, self.nz) self.times = np.array([0, 1]) self.tube.set_times(self.times) self.tube.set_pressure_bc( receiver.PressureBC(self.times, self.times * 0)) self.emodel = elasticity.IsotropicLinearElasticModel( self.E, "youngs", self.nu, "poissons") self.mat = models.SmallStrainElasticity(self.emodel) self.d = 0.25 self.force_exact = (np.pi * (self.ro**2.0 - self.ri**2.0) * self.E * self.d / self.h) self.stiffness_exact = (np.pi * (self.ro**2.0 - self.ri**2.0) * self.E / self.h) self.solver = structural.PythonTubeSolver(verbose=False)
def setUp(self): self.G1 = 36000.0 self.G2 = 25000.0 self.K1 = 10000.0 self.K2 = 12000.0 self.elastic1 = elasticity.IsotropicLinearElasticModel( self.G1, "shear", self.K1, "bulk") self.elastic2 = elasticity.IsotropicLinearElasticModel( self.G2, "shear", self.K2, "bulk") self.emodel1 = models.SmallStrainElasticity(self.elastic1) self.emodel2 = models.SmallStrainElasticity(self.elastic2) self.tiny_strain = np.array([1e-6, 0, 0, 0, 0, 0]) self.T = 300.0 self.t = 1e-9
def setUp(self): self.E = 100000.0 self.nu = 0.29 self.elastic = elasticity.IsotropicLinearElasticModel( self.E, "youngs", self.nu, "poissons") self.model = models.SmallStrainElasticity(self.elastic) self.conditions = [{ 'hist_n': np.zeros((6, )), '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': np.zeros((6, )), '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 setUp(self): self.hist0 = np.array([]) 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.elastic = elasticity.IsotropicLinearElasticModel( self.mu, "shear", self.K, "bulk") self.model = models.SmallStrainElasticity(self.elastic) 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 gen_tube(k, tforce, tube_length, tube_ri, E, alpha, nr=5): emodel = elasticity.IsotropicLinearElasticModel(E, "youngs", 0.25, "poissons") mmodel = models.SmallStrainElasticity(emodel, alpha=alpha) solver = structural.PythonTubeSolver(atol=1.0e-4) ro = np.sqrt(tube_length * k / (np.pi * E) + tube_ri**2.0) A = np.pi * (ro**2.0 - tube_ri**2.0) tube = receiver.Tube(ro, ro - tube_ri, tube_length, nr, 1, 1) tube.set_times(np.array([0, 1.0])) tube.make_1D(tube_length / 2.0, 0) dT = tforce / (E * alpha * A) temp = np.zeros((2, nr)) temp[1] = dT tube.add_results("temperature", temp) tube.set_pressure_bc( receiver.PressureBC(np.array([0, 1]), np.array([0, 0]))) return spring.TubeSpring(tube, solver, mmodel)
def test_linear_elastic(self): model = models.SmallStrainElasticity(self.elastic1) self.are_equal(self.elastic1, model.elastic) model.set_elastic_model(self.elastic2) self.are_equal(self.elastic2, model.elastic)
s0 = 100.0 A = s0**(-n) A = 1.0e-22 # Damage parameters xi = 0.478 phi = 1.914 S = 1.0e19 # Loading srate = 100.0 # Setup model emodel = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") bmodel = models.SmallStrainElasticity(emodel) scmodel = creep.PowerLawCreep(A, n) cfmodel = creep.J2CreepModel(scmodel) cmodel = models.SmallStrainCreepPlasticity(emodel, bmodel, cfmodel) model = damage.ClassicalCreepDamageModel_sd(emodel, S, xi, phi, cmodel) model2 = damage.ModularCreepDamageModel_sd( emodel, S, xi, phi, damage.VonMisesEffectiveStress(), cmodel) # Computed life srange = np.linspace(s0 / 2, s0, 10) tfs = S**(xi) / (1 + phi) * srange**(-xi) slife = [] slife2 = [] for s, tf in zip(srange, tfs):
def elastic_model(E, a, nu=0.3): elmodel = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") return models.SmallStrainElasticity(elmodel, alpha=a)
def make_mat(self): emodel = elasticity.IsotropicLinearElasticModel( self.E, "youngs", self.nu, "poissons") return models.SmallStrainElasticity(emodel, alpha=self.alpha)
def gen_material(E, nu, alpha): elastic = elasticity.IsotropicLinearElasticModel(E, "youngs", nu, "poissons") return models.SmallStrainElasticity(elastic, alpha = alpha)