コード例 #1
0
ファイル: viscoelastic2.py プロジェクト: SeisSol/SeisSol
  def __init__(self, order, multipleSimulations, matricesDir, memLayout, numberOfMechanisms):
    super().__init__(order, multipleSimulations, matricesDir)

    self.numberOfMechanisms = numberOfMechanisms

    clones = {
      'star': ['star(0)', 'star(1)', 'star(2)'],
    }
    self.db.update( parseXMLMatrixFile('{}/matrices_viscoelastic.xml'.format(matricesDir), clones) )
    memoryLayoutFromFile(memLayout, self.db, clones)

    self._qShapeExtended = (self.numberOf3DBasisFunctions(), self.numberOfExtendedQuantities())
    self._qShapeAnelastic = (self.numberOf3DBasisFunctions(), self.numberOfAnelasticQuantities(), self.numberOfMechanisms)
    self.Qext = OptionalDimTensor('Qext', self.Q.optName(), self.Q.optSize(), self.Q.optPos(), self._qShapeExtended, alignStride=True)
    self.Qane = OptionalDimTensor('Qane', self.Q.optName(), self.Q.optSize(), self.Q.optPos(), self._qShapeAnelastic, alignStride=True)
    self.Iane = OptionalDimTensor('Iane', self.Q.optName(), self.Q.optSize(), self.Q.optPos(), self._qShapeAnelastic, alignStride=True)

    self.E = Tensor('E', (self.numberOfAnelasticQuantities(), self.numberOfMechanisms, self.numberOfQuantities()))
    self.w = Tensor('w', (self.numberOfMechanisms,))
    self.W = Tensor('W', (self.numberOfMechanisms, self.numberOfMechanisms), np.eye(self.numberOfMechanisms, dtype=bool), CSCMemoryLayout)

    selectElaSpp = np.zeros((self.numberOfExtendedQuantities(), self.numberOfQuantities()))
    selectElaSpp[0:self.numberOfQuantities(),0:self.numberOfQuantities()] = np.eye(self.numberOfQuantities())
    self.selectEla = Tensor('selectEla', (self.numberOfExtendedQuantities(), self.numberOfQuantities()), selectElaSpp, CSCMemoryLayout)

    selectAneSpp = np.zeros((self.numberOfExtendedQuantities(), self.numberOfAnelasticQuantities()))
    selectAneSpp[self.numberOfQuantities():self.numberOfExtendedQuantities(),0:self.numberOfAnelasticQuantities()] = np.eye(self.numberOfAnelasticQuantities())
    self.selectAne = Tensor('selectAne', (self.numberOfExtendedQuantities(), self.numberOfAnelasticQuantities()), selectAneSpp, CSCMemoryLayout)
コード例 #2
0
 def __init__(self, order, multipleSimulations, matricesDir, memLayout):
   super().__init__(order, multipleSimulations, matricesDir)
   clones = {
     'star': ['star(0)', 'star(1)', 'star(2)'],
   }
   self.db.update( parseXMLMatrixFile('{}/star.xml'.format(matricesDir), clones) )
   memoryLayoutFromFile(memLayout, self.db, clones)
コード例 #3
0
    def __init__(self, order, multipleSimulations, matricesDir, memLayout,
                 numberOfMechanisms, **kwargs):

        super().__init__(order, multipleSimulations, matricesDir)
        clones = {
            'star': ['star(0)', 'star(1)', 'star(2)'],
        }
        self.db.update(
            parseXMLMatrixFile(
                '{}/matrices_poroelastic.xml'.format(matricesDir), clones))
        self.db.update(
            parseJSONMatrixFile('{}/stp_{}.json'.format(matricesDir, order),
                                clones))

        memoryLayoutFromFile(memLayout, self.db, clones)
コード例 #4
0
ファイル: viscoelastic.py プロジェクト: wangxch2019/SeisSol
    def __init__(self, order, multipleSimulations, matricesDir, memLayout,
                 numberOfMechanisms, **kwargs):
        self.numberOfMechanisms = numberOfMechanisms
        self.numberOfElasticQuantities = 9

        super().__init__(order, multipleSimulations, matricesDir)
        clones = {
            'star': ['star(0)', 'star(1)', 'star(2)'],
        }
        self.db.update(
            parseXMLMatrixFile(
                '{}/matrices_viscoelastic.xml'.format(matricesDir), clones))

        star_spp = self.db.star[0].spp().as_ndarray()
        star_rows, star_cols = star_spp.shape
        aniso_cols = star_cols - self.numberOfElasticQuantities
        star_spp_new = np.zeros(
            (self.numberOfQuantities(), self.numberOfQuantities()), dtype=bool)
        star_spp_new[0:star_rows, 0:star_cols] = star_spp
        ''' The last 6 columns of star_spp contain the prototype sparsity pattern for
        a mechanism. Therefore, the spp is repeated for every mechanism. '''
        for mech in range(1, numberOfMechanisms):
            offset0 = self.numberOfElasticQuantities
            offsetm = self.numberOfElasticQuantities + mech * aniso_cols
            star_spp_new[0:star_rows, offsetm:offsetm +
                         aniso_cols] = star_spp[0:star_rows,
                                                offset0:offset0 + aniso_cols]
        for dim in range(3):
            self.db.star[dim] = Tensor(self.db.star[dim].name(),
                                       star_spp_new.shape,
                                       spp=star_spp_new)

        source_spp = np.zeros(
            (self.numberOfQuantities(), self.numberOfQuantities()), dtype=bool)
        ET_spp = self.db['ET'].spp().as_ndarray()
        ''' ET is a prototype sparsity pattern for a mechanism. Therefore, repeated for every
        mechanism. See Kaeser and Dumbser 2006, III. Viscoelastic attenuation.
    '''
        for mech in range(numberOfMechanisms):
            offset = self.numberOfElasticQuantities + mech * aniso_cols
            r = slice(offset, offset + aniso_cols)
            source_spp[r, 0:aniso_cols] = ET_spp
            source_spp[r, r] = np.identity(aniso_cols, dtype=bool)
        self.db.ET = Tensor('ET', source_spp.shape, spp=source_spp)

        memoryLayoutFromFile(memLayout, self.db, clones)
コード例 #5
0
ファイル: viscoelastic2.py プロジェクト: marscfeng/SeisSol
  def __init__(self, order, multipleSimulations, matricesDir, memLayout, numberOfMechanisms, **kwargs):
    super().__init__(order, multipleSimulations, matricesDir)

    self.numberOfMechanisms = numberOfMechanisms

    clones = {
      'star': ['star(0)', 'star(1)', 'star(2)'],
    }
    self.db.update( parseXMLMatrixFile('{}/matrices_viscoelastic.xml'.format(matricesDir), clones) )
    memoryLayoutFromFile(memLayout, self.db, clones)

    self._qShapeExtended = (self.numberOf3DBasisFunctions(), self.numberOfExtendedQuantities())
    self._qShapeAnelastic = (self.numberOf3DBasisFunctions(), self.numberOfAnelasticQuantities(), self.numberOfMechanisms)
    self.Qext = OptionalDimTensor('Qext', self.Q.optName(), self.Q.optSize(), self.Q.optPos(), self._qShapeExtended, alignStride=True)
    self.Qane = OptionalDimTensor('Qane', self.Q.optName(), self.Q.optSize(), self.Q.optPos(), self._qShapeAnelastic, alignStride=True)
    self.Iane = OptionalDimTensor('Iane', self.Q.optName(), self.Q.optSize(), self.Q.optPos(), self._qShapeAnelastic, alignStride=True)

    self.E = Tensor('E', (self.numberOfAnelasticQuantities(), self.numberOfMechanisms, self.numberOfQuantities()))
    self.w = Tensor('w', (self.numberOfMechanisms,))
    self.W = Tensor('W', (self.numberOfMechanisms, self.numberOfMechanisms), np.eye(self.numberOfMechanisms, dtype=bool), CSCMemoryLayout)

    selectElaSpp = np.zeros((self.numberOfExtendedQuantities(), self.numberOfQuantities()))
    selectElaSpp[0:self.numberOfQuantities(),0:self.numberOfQuantities()] = np.eye(self.numberOfQuantities())
    self.selectEla = Tensor('selectEla', (self.numberOfExtendedQuantities(), self.numberOfQuantities()), selectElaSpp, CSCMemoryLayout)

    selectAneSpp = np.zeros((self.numberOfExtendedQuantities(), self.numberOfAnelasticQuantities()))
    selectAneSpp[self.numberOfQuantities():self.numberOfExtendedQuantities(),0:self.numberOfAnelasticQuantities()] = np.eye(self.numberOfAnelasticQuantities())
    self.selectAne = Tensor('selectAne', (self.numberOfExtendedQuantities(), self.numberOfAnelasticQuantities()), selectAneSpp, CSCMemoryLayout)

    self.db.update(
      parseJSONMatrixFile('{}/nodal/nodalBoundary_matrices_{}.json'.format(matricesDir,
                                                                           self.order),
                          {},
                          alignStride=self.alignStride,
                          transpose=self.transpose,
                          namespace='nodal')
    )
コード例 #6
0
ファイル: acoustics.py プロジェクト: TUM-I5/LinA
numberOfQuantities = 3

qShape = (numberOf1DBasisFunctions, numberOf1DBasisFunctions,
          numberOfQuantities)
qShape1 = (numberOf1DBasisFunctions, numberOfQuantities)

clones = {'kDivM': ['kDivM', 'kDivMT'], 'kTDivM': ['kTDivM', 'kTDivMT']}
transpose = {'kDivMT', 'kTDivMT'}
alignStride = {'kDivM', 'kTDivM'}
db = parseJSONMatrixFile('{}/matrices_{}.json'.format(cmdLineArgs.matricesDir,
                                                      degree),
                         clones,
                         transpose=transpose,
                         alignStride=alignStride)
db.update(parseJSONMatrixFile('{}/star.json'.format(cmdLineArgs.matricesDir)))
memoryLayoutFromFile(cmdLineArgs.memLayout, db, dict())

Q = Tensor('Q', qShape)
Q1 = Tensor('Q1', qShape1)
Q1Neighbour = Tensor('Q1Neighbour', qShape1)
dQ0 = Tensor('dQ(0)', qShape)
I = Tensor('I', qShape)
phi = [
    Tensor('phi({})'.format(i), (numberOf1DBasisFunctions, )) for i in range(2)
]
phiDivM = [
    Tensor('phiDivM({})'.format(i), (numberOf1DBasisFunctions, ))
    for i in range(2)
]
source = Tensor('source', (numberOfQuantities, ))