def addMatrices(db, matricesDir, order, dynamicRuptureMethod, numberOfElasticQuantities, numberOfQuantities): numberOfBasisFunctions = Tools.numberOfBasisFunctions(order) if dynamicRuptureMethod == 'quadrature': numberOfPoints = (order + 1)**2 elif dynamicRuptureMethod == 'cellaverage': numberOfPoints = int(4**math.ceil(math.log(order * (order + 1) / 2, 4))) else: raise ValueError('Unknown dynamic rupture method.') clones = dict() # Load matrices db.update( Tools.parseMatrixFile( '{}/dr_{}_matrices_{}.xml'.format(matricesDir, dynamicRuptureMethod, order), clones)) # Determine matrices # Note: This does only work because the flux does not depend on the mechanisms in the case of viscoelastic attenuation godunovMatrixSpp = np.matlib.zeros( (numberOfQuantities, numberOfQuantities)) godunovMatrixSpp[0:numberOfElasticQuantities, 0:numberOfElasticQuantities] = 1. db.insert( DB.MatrixInfo('godunovMatrix', numberOfQuantities, numberOfQuantities, matrix=godunovMatrixSpp)) fluxSolverSpp = np.matlib.zeros((numberOfQuantities, numberOfQuantities)) fluxSolverSpp[0:numberOfElasticQuantities, :] = 1. db.insert( DB.MatrixInfo('fluxSolver', numberOfQuantities, numberOfQuantities, matrix=fluxSolverSpp)) godunovStateSpp = np.matlib.zeros((numberOfPoints, numberOfQuantities)) godunovStateSpp[:, 0:numberOfElasticQuantities] = 1. db.insert( DB.MatrixInfo('godunovState', numberOfPoints, numberOfQuantities, matrix=godunovStateSpp)) stiffnessOrder = {'Xi': 0, 'Eta': 1, 'Zeta': 2} globalMatrixIdRules = [(r'^pP(\d{1})$', lambda x: (int(x[0]) - 1) * 4), (r'^pM(\d{1})(\d{1})$', lambda x: (int(x[0]) - 1) * 4 + int(x[1])), (r'^nP(\d{1})$', lambda x: 16 + (int(x[0]) - 1) * 4), (r'^nM(\d{1})(\d{1})$', lambda x: 16 + (int(x[0]) - 1) * 4 + int(x[1]))] DB.determineGlobalMatrixIds(globalMatrixIdRules, db, 'dr')
def addMatrices(db, matricesDir, PlasticityMethod, order): numberOfBasisFunctions = Tools.numberOfBasisFunctions(order) clones = dict() # Load matrices db.update(Tools.parseMatrixFile('{}/plasticity_{}_matrices_{}.xml'.format(matricesDir, PlasticityMethod, order), clones)) # force Aligned in order to be compatible with regular DOFs. db.insert(DB.MatrixInfo('stressDOFS', numberOfBasisFunctions, 6, forceAligned=True)) matrixOrder = { 'v': 0, 'vInv': 1 } globalMatrixIdRules = [ (r'^(v|vInv)$', lambda x: matrixOrder[x[0]]) ] DB.determineGlobalMatrixIds(globalMatrixIdRules, db, 'plasticity')
architecture = Arch.getArchitectureByIdentifier(cmdLineArgs.arch) libxsmmGenerator = cmdLineArgs.generator order = int(cmdLineArgs.order) numberOfMechanisms = int(cmdLineArgs.numberOfMechanisms) numberOfBasisFunctions = Tools.numberOfBasisFunctions(order) numberOfElasticQuantities = 9 numberOfMechanismQuantities = 6 numberOfReducedQuantities = numberOfElasticQuantities + numberOfMechanismQuantities numberOfQuantities = numberOfElasticQuantities + 6*numberOfMechanisms clones = { 'star': [ 'AstarT', 'BstarT', 'CstarT' ] } # 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
cmdLineParser.add_argument('--memLayout') cmdLineArgs = cmdLineParser.parse_args() architecture = Arch.getArchitectureByIdentifier(cmdLineArgs.arch) libxsmmGenerator = cmdLineArgs.generator order = int(cmdLineArgs.order) numberOfMechanisms = int(cmdLineArgs.numberOfMechanisms) numberOfBasisFunctions = Tools.numberOfBasisFunctions(order) numberOfQuantities = 9 + 6*numberOfMechanisms clones = { 'star': [ 'AstarT', 'BstarT', 'CstarT' ] } # 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, numberOfQuantities), dtype=np.float64)], [np.matlib.zeros((numberOfQuantities-9, numberOfQuantities), dtype=np.float64)]]) db.insert(DB.MatrixInfo('AplusT', numberOfQuantities, numberOfQuantities, sparsityPattern=riemannSolverSpp)) db.insert(DB.MatrixInfo('AminusT', numberOfQuantities, numberOfQuantities, sparsityPattern=riemannSolverSpp)) mechMatrix = np.matlib.zeros((15, numberOfQuantities)) mechMatrix[0:9,0:9] = np.matlib.identity(9) for m in range(0, numberOfMechanisms): 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']:
cmdLineParser.add_argument('--generator') cmdLineParser.add_argument('--memLayout') cmdLineParser.add_argument('--dynamicRuptureMethod') cmdLineParser.add_argument('--PlasticityMethod') cmdLineArgs = cmdLineParser.parse_args() architecture = Arch.getArchitectureByIdentifier(cmdLineArgs.arch) libxsmmGenerator = cmdLineArgs.generator order = int(cmdLineArgs.order) numberOfBasisFunctions = Tools.numberOfBasisFunctions(order) numberOfQuantities = 9 clones = {'star': ['AstarT', 'BstarT', 'CstarT']} db = Tools.parseMatrixFile( '{}/matrices_{}.xml'.format(cmdLineArgs.matricesDir, numberOfBasisFunctions), clones) db.insert(DB.MatrixInfo('AplusT', numberOfQuantities, numberOfQuantities)) db.insert(DB.MatrixInfo('AminusT', numberOfQuantities, numberOfQuantities)) DynamicRupture.addMatrices(db, cmdLineArgs.matricesDir, order, cmdLineArgs.dynamicRuptureMethod, numberOfQuantities, numberOfQuantities) Plasticity.addMatrices(db, cmdLineArgs.matricesDir, cmdLineArgs.PlasticityMethod, order) SurfaceDisplacement.addMatrices(db, order) # Load sparse-, dense-, block-dense-config Tools.memoryLayoutFromFile(cmdLineArgs.memLayout, db, clones)
cmdLineParser.add_argument('--dynamicRuptureMethod') cmdLineParser.add_argument('--PlasticityMethod') cmdLineArgs = cmdLineParser.parse_args() architecture = Arch.getArchitectureByIdentifier(cmdLineArgs.arch) libxsmmGenerator = cmdLineArgs.generator order = int(cmdLineArgs.order) numberOfBasisFunctions = Tools.numberOfBasisFunctions(order) numberOf3DQuadraturePoints = (order+1)**3 numberOfQuantities = 9 clones = { 'star': [ 'AstarT', 'BstarT', 'CstarT' ] } db = Tools.parseMatrixFile('{}/matrices_{}.xml'.format(cmdLineArgs.matricesDir, numberOfBasisFunctions), clones) clonesQP = { 'v': [ 'evalAtQP' ], 'vInv': [ 'projectQP' ] } db.update( Tools.parseMatrixFile('{}/plasticity_ip_matrices_{}.xml'.format(cmdLineArgs.matricesDir, order), clonesQP)) db.insert(DB.MatrixInfo('AplusT', numberOfQuantities, numberOfQuantities)) db.insert(DB.MatrixInfo('AminusT', numberOfQuantities, numberOfQuantities)) DynamicRupture.addMatrices(db, cmdLineArgs.matricesDir, order, cmdLineArgs.dynamicRuptureMethod, numberOfQuantities, numberOfQuantities) Plasticity.addMatrices(db, cmdLineArgs.matricesDir, cmdLineArgs.PlasticityMethod, order) SurfaceDisplacement.addMatrices(db, order) # Load sparse-, dense-, block-dense-config