# Load matrices db = Tools.parseMatrixFile('{}/matrices_{}.xml'.format(cmdLineArgs.matricesDir, numberOfBasisFunctions), clones) db.update(Tools.parseMatrixFile('{}/matrices_viscoelastic.xml'.format(cmdLineArgs.matricesDir), clones)) # Determine sparsity patterns that depend on the number of mechanisms riemannSolverSpp = np.bmat([[np.matlib.ones((9, numberOfReducedQuantities), dtype=np.float64)], [np.matlib.zeros((numberOfReducedQuantities-9, numberOfReducedQuantities), dtype=np.float64)]]) db.insert(DB.MatrixInfo('AplusT', numberOfReducedQuantities, numberOfReducedQuantities, matrix=riemannSolverSpp)) db.insert(DB.MatrixInfo('AminusT', numberOfReducedQuantities, numberOfReducedQuantities, matrix=riemannSolverSpp)) DynamicRupture.addMatrices(db, cmdLineArgs.matricesDir, order, cmdLineArgs.dynamicRuptureMethod, numberOfElasticQuantities, numberOfReducedQuantities) Plasticity.addMatrices(db, cmdLineArgs.matricesDir, cmdLineArgs.PlasticityMethod, order) SurfaceDisplacement.addMatrices(db, order) # Load sparse-, dense-, block-dense-config Tools.memoryLayoutFromFile(cmdLineArgs.memLayout, db, clones) # Set rules for the global matrix memory order stiffnessOrder = { 'Xi': 0, 'Eta': 1, 'Zeta': 2 } globalMatrixIdRules = [ (r'^k(Xi|Eta|Zeta)DivMT$', lambda x: stiffnessOrder[x[0]]), (r'^k(Xi|Eta|Zeta)DivM$', lambda x: 3 + stiffnessOrder[x[0]]), (r'^r(\d{1})DivM$', lambda x: 6 + int(x[0])-1), (r'^rT(\d{1})$', lambda x: 10 + int(x[0])-1), (r'^fMrT(\d{1})$', lambda x: 14 + int(x[0])-1), (r'^fP(\d{1})$', lambda x: 18 + (int(x[0])-1)) ] DB.determineGlobalMatrixIds(globalMatrixIdRules, db) # Kernels kernels = list()
mechMatrix[9:15,9+6*m:9+6*(m+1)] = np.matlib.identity(6) tallMatrix = np.matlib.zeros((numberOfQuantities, 15)) tallMatrix[0:15,0:15] = db[clones['star'][0]].spp starMatrix = tallMatrix * mechMatrix for clone in clones['star']: db.insert(DB.MatrixInfo(clone, starMatrix.shape[0], starMatrix.shape[1], starMatrix)) source = np.matlib.zeros((numberOfQuantities, numberOfQuantities)) for m in range(0, numberOfMechanisms): r = slice(9+6*m, 9+6*(m+1)) source[r,0:6] = db['ET'].spp source[r,r] = np.matlib.identity(6) db.insert(DB.MatrixInfo('source', numberOfQuantities, numberOfQuantities, source)) # Load sparse-, dense-, block-dense-config Tools.memoryLayoutFromFile(cmdLineArgs.memLayout, db, clones) # Set rules for the global matrix memory order stiffnessOrder = { 'Xi': 0, 'Eta': 1, 'Zeta': 2 } globalMatrixIdRules = [ (r'^k(Xi|Eta|Zeta)DivMT$', lambda x: stiffnessOrder[x[0]]), (r'^k(Xi|Eta|Zeta)DivM$', lambda x: 3 + stiffnessOrder[x[0]]), (r'^fM(\d{1})$', lambda x: 6 + int(x[0])-1), (r'^fP(\d{1})(\d{1})(\d{1})$', lambda x: 10 + (int(x[0])-1)*12 + (int(x[1])-1)*3 + (int(x[2])-1)) ] DB.determineGlobalMatrixIds(globalMatrixIdRules, db) # Kernels kernels = list() db.insert(DB.MatrixInfo('timeIntegrated', numberOfBasisFunctions, numberOfQuantities))