예제 #1
0
	def computeRotationMatrices(self, numThetaSteps = 10, numPhiSteps = 10):
		self.thetaList = np.arange(numThetaSteps, dtype = np.float64) / numThetaSteps * m.pi
		self.phiList = np.arange(numPhiSteps, dtype = np.float64) / numPhiSteps * m.pi
		self.rotMatrices = np.zeros(shape = (numThetaSteps, numPhiSteps, 3, 3), dtype = np.float64)
		for i in range(numThetaSteps):
			for j in range(numPhiSteps):
				self.rotMatrices[i, j, ...] = STC.getRotationTwoAngleTransf(
					theta = self.thetaList[i], phi = self.phiList[j])
예제 #2
0
	def scaleStresses(self, k = 2.0):
		if (self.useCompiledExtensions):
			# Allocate array for scaled stresses
			self.stressesScaled = self.stressSeries * 1.0
			Mech.scaleStressSeries_MultiaxialDamage(self.stressesScaled, k)
		else:
			# Allocate array for scaled stresses
			self.stressesScaled = self.stressSeries * 0
			numSamples = self.stressSeries.shape[0]
			# Min/max stress ratios
			V = np.ones(numSamples)
			for i in range(self.stressSeries.shape[0]):
				if (np.max(np.abs(self.stressSeries[i, :])) > 1e-8):
					#sPrincipal = np.zeros((3,), dtype = S.floatT)
					#sPrincipal = DC.computePrincipalStresses(self.stressSeries[i, :])
					sPrincipal = STC.computePrincipalStresses(self.stressSeries[i, :])
					if ((sPrincipal[0] <=  sPrincipal[1]) and (sPrincipal[1] <=  sPrincipal[2])):
						pass
					else:
						print sPrincipal 
					#err = np.abs(np.sum(sPrincipal - sPrincipalSeries[i, :]) / np.sum(sPrincipal))
					#if ( err > 1e-8):
					#	print ('Pricipal stresses calculation problem: err = {}, s1 = {}, s2 = {}'.format(err, sPrincipal, sPrincipalSeries[i, :]))
					# Take the ratio of min/max stress
					# V = -1: dominating shear stress
					# V = 0: dominating tension/copression stress
					# V = 1: hydro-static pressure
					if (abs(sPrincipal[0]) > abs(sPrincipal[2])):
						V = sPrincipal[2] / sPrincipal[0]
					else:
						V = sPrincipal[0] / sPrincipal[2]
					# Scale coefficient
					f = 1 + (1 - k) * V
				else:
					f = 1.0
				self.stressesScaled[i, :] = self.stressSeries[i, :] * f