def __init__(self, stiffness, density, interface_norm = [0, 0, 1]):
     self.ch_obj = ch.Christoffel(stiffness, density)
     self.interface_norm = np.array(interface_norm)
     #Unlike Christoffel, don't need to divide by desnity. Can see this by comparing
     #eigenvalue equations
     self.rank4c = np.array(ch.de_voigt(stiffness)) * 1000
     #Set the z_direction to (0,0,1) and the x_direction to (1,0,0)
     self.ch_obj.rotate_tensor(x_dir = [1.0, 0.0, 0.0], z_dir = [0.0, 0.0, 1.0])
     self.density = density
Exemple #2
0
config.read('sound.in')

# An error in reading the tensor or density should crash the script.
# Can't do anything without a stiffness tensor.

List = config.get('SCAN', 'stiffness').split()
stiffness_vector = np.zeros((36, 1))
stiffness_tensor = np.zeros((6, 6))

for i in range(36):
    stiffness_vector[i] = float(List[i])
stiffness_tensor = np.reshape(stiffness_vector, (6, 6))
density = config.getfloat('SCAN', 'density')  #kg/m^3

# Creation of the central Christoffel object
chris = christoffel.Christoffel(stiffness_tensor, density)

#Read in rotation information if present
try:
    zdir = map(float, config.get('SCAN', 'zdir').split())
except:
    zdir = None
try:
    xdir = map(float, config.get('SCAN', 'xdir').split())
except:
    xdir = None

#Read special directions if present
try:
    directions = map(float, config.get('SCAN', 'directions').split())
    directions = np.reshape(directions, (len(directions) / 3, 3))