*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
tps1hee.py 2.08 KiB
### TPS1H = TPS1 with mass lumping ###
from . import tps1


################################################################################


class TPS1HEE(tps1.TPS1):


#------------------------------------------------------------------------------#


  def _SetUpSystems(self):
    import numpy as np
    import scipy.sparse as sp
    from commics._tools import ScipySparseFromNgMatrix
    from ngsolve import TaskManager, TET, IntegrationRule, SymbolicLFI \
      , LinearForm, SymbolicBFI, BilinearForm, IntegrationRule

    massLumping = IntegrationRule( \
      points = [(0,0,0), (1,0,0), (0,1,0), (0,0,1)] \
      , weights = [1/24, 1/24, 1/24, 1/24] )


    #blf
    lhs_stat_1_cf = self._MassTerm()
    lhs_stat_2_cf = self._StiffTerm()
    lhs_instat_cf = self._SkewTerm()
    
    self._a_stat_1 = BilinearForm(self._X)
    self._a_stat_1 += SymbolicBFI( \
      lhs_stat_1_cf.Compile(realcompile=True, wait=True), intrule=massLumping)
    
    with TaskManager():
      self._a_stat_1.Assemble()
    self._A_stat_1 = ScipySparseFromNgMatrix(self._a_stat_1)
    
    self._a_stat_2 = BilinearForm(self._X)
    self._a_stat_2 += SymbolicBFI(lhs_stat_2_cf.Compile(realcompile=True, wait=True))
    
    with TaskManager():
      self._a_stat_2.Assemble()
    self._A_stat_2 = ScipySparseFromNgMatrix(self._a_stat_2)
    
    self._A_stat = self._A_stat_1 + self._A_stat_2
    self._A_stat.eliminate_zeros()


    self._a_instat = BilinearForm(self._X)
    self._a_instat += SymbolicBFI( \
      lhs_instat_cf.Compile(realcompile=True, wait=True), intrule=massLumping )
    
    with TaskManager():
      self._a_instat.Assemble()
    self._A_instat = ScipySparseFromNgMatrix(self._a_instat) 


    #lf
    rhs_cf = self._ExchangeTerm()
    rhs_cf += self._LinearTerms_pi()
    rhs_cf += self._NonLinearTerms_Pi()
    rhs_cf += self._ExplicitTerms()

    self._f = LinearForm(self._X)
    self._f += SymbolicLFI(rhs_cf.Compile(realcompile=True, wait=True))


#------------------------------------------------------------------------------#


################################################################################