(generator, aderdg)
| 44 | from multSim import OptionalDimTensor |
| 45 | |
| 46 | def addKernels(generator, aderdg): |
| 47 | numberOf3DBasisFunctions = aderdg.numberOf3DBasisFunctions() |
| 48 | numberOfQuantities = aderdg.numberOfQuantities() |
| 49 | order = aderdg.order |
| 50 | ## Point sources |
| 51 | mStiffnessTensor = Tensor('stiffnessTensor', (3,3,3,3)) |
| 52 | mSlip = Tensor('mSlip', (3,)) |
| 53 | mNormal = Tensor('mNormal', (3,)) |
| 54 | mArea = Scalar('mArea') |
| 55 | basisFunctionsAtPoint = Tensor('basisFunctionsAtPoint', (numberOf3DBasisFunctions,)) |
| 56 | basisFunctionDerivativesAtPoint = Tensor('basisFunctionDerivativesAtPoint', (numberOf3DBasisFunctions, 3)) |
| 57 | timeBasisFunctionsAtPoint = Tensor('timeBasisFunctionsAtPoint', (order,)) |
| 58 | mInvJInvPhisAtSources = Tensor('mInvJInvPhisAtSources', (numberOf3DBasisFunctions,)) |
| 59 | JInv = Scalar('JInv') |
| 60 | |
| 61 | generator.add('computeMInvJInvPhisAtSources', |
| 62 | mInvJInvPhisAtSources['k'] <= JInv * aderdg.db.M3inv['kl'] * basisFunctionsAtPoint['l']) |
| 63 | |
| 64 | #extract the moment tensors entries in SeisSol ordering (xx, yy, zz, xy, yz, xz) |
| 65 | assert(numberOfQuantities >= 6) |
| 66 | momentToNRF_spp = np.zeros((numberOfQuantities, 3, 3)) |
| 67 | momentToNRF_spp[0, 0, 0] = 1 |
| 68 | momentToNRF_spp[1, 1, 1] = 1 |
| 69 | momentToNRF_spp[2, 2, 2] = 1 |
| 70 | momentToNRF_spp[3, 0, 1] = 1 |
| 71 | momentToNRF_spp[4, 1, 2] = 1 |
| 72 | momentToNRF_spp[5, 0, 2] = 1 |
| 73 | momentToNRF = Tensor('momentToNRF', (numberOfQuantities, 3, 3), spp=momentToNRF_spp) |
| 74 | |
| 75 | momentNRFKernel = momentToNRF['tpq'] * mArea * mStiffnessTensor['pqij'] * mSlip['i'] * mNormal['j'] |
| 76 | |
| 77 | if aderdg.Q.hasOptDim(): |
| 78 | sourceNRF = aderdg.Q['kt'] <= aderdg.Q['kt'] + mInvJInvPhisAtSources['k'] * momentNRFKernel * aderdg.oneSimToMultSim['s'] |
| 79 | else: |
| 80 | sourceNRF = aderdg.Q['kt'] <= aderdg.Q['kt'] + mInvJInvPhisAtSources['k'] * momentNRFKernel |
| 81 | generator.add('sourceNRF', sourceNRF) |
| 82 | |
| 83 | momentFSRM = Tensor('momentFSRM', (numberOfQuantities,)) |
| 84 | stfIntegral = Scalar('stfIntegral') |
| 85 | if aderdg.Q.hasOptDim(): |
| 86 | sourceFSRM = aderdg.Q['kp'] <= aderdg.Q['kp'] + stfIntegral * mInvJInvPhisAtSources['k'] * momentFSRM['p'] * aderdg.oneSimToMultSim['s'] |
| 87 | else: |
| 88 | sourceFSRM = aderdg.Q['kp'] <= aderdg.Q['kp'] + stfIntegral * mInvJInvPhisAtSources['k'] * momentFSRM['p'] |
| 89 | generator.add('sourceFSRM', sourceFSRM) |
| 90 | |
| 91 | ## Receiver output |
| 92 | QAtPoint = OptionalDimTensor('QAtPoint', aderdg.Q.optName(), aderdg.Q.optSize(), aderdg.Q.optPos(), (numberOfQuantities,)) |
| 93 | evaluateDOFSAtPoint = QAtPoint['p'] <= aderdg.Q['kp'] * basisFunctionsAtPoint['k'] |
| 94 | generator.add('evaluateDOFSAtPoint', evaluateDOFSAtPoint) |
| 95 | QDerivativeAtPoint = OptionalDimTensor('QDerivativeAtPoint', aderdg.Q.optName(), aderdg.Q.optSize(), aderdg.Q.optPos(), (numberOfQuantities, 3)) |
| 96 | evaluateDerivativeDOFSAtPoint = QDerivativeAtPoint['pd'] <= aderdg.Q['kp'] * basisFunctionDerivativesAtPoint['kd'] |
| 97 | generator.add('evaluateDerivativeDOFSAtPoint', evaluateDerivativeDOFSAtPoint) |
| 98 | |
| 99 | stpShape = (numberOf3DBasisFunctions, numberOfQuantities, order) |
| 100 | spaceTimePredictor = OptionalDimTensor('spaceTimePredictor', aderdg.Q.optName(), aderdg.Q.optSize(), aderdg.Q.optPos(), stpShape, alignStride=True) |
| 101 | evaluateDOFSAtPointSTP = QAtPoint['p'] <= spaceTimePredictor['kpt'] * basisFunctionsAtPoint['k'] * timeBasisFunctionsAtPoint['t'] |
| 102 | generator.add('evaluateDOFSAtPointSTP', evaluateDOFSAtPointSTP) |
| 103 | spaceTimePredictor = OptionalDimTensor('spaceTimePredictor', aderdg.Q.optName(), aderdg.Q.optSize(), aderdg.Q.optPos(), stpShape, alignStride=True) |
nothing calls this directly
no test coverage detected