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

Skip to content
Snippets Groups Projects
Commit 4f4f3a7b authored by Carl-Martin Pfeiler's avatar Carl-Martin Pfeiler
Browse files

Merge commit 'f25c1eb4'

- merge in work done for the TPS2paper revision:
  + Improvements (efficiency) in pure TPS2
  + TPS2AB with EE for lower order terms in first time-step
parents e2e77c4d f25c1eb4
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,8 @@ from commics.integrators.kw1_mps import KW1_MPS
from commics.integrators.tps1_kw2 import TPS1_KW2
from commics.integrators.tps1_mps import TPS1_MPS
from commics.integrators.tps2ab_initial_tps2ee import TPS2AB_INITIAL_TPS2EE
__all__ = \
[ "Integrator" \
, "DUMMY" \
......@@ -36,4 +38,5 @@ __all__ = \
, "TPS1HEE" \
, "TPS1HEE_MPS" \
, "KW1_MPS", "TPS1_KW2", "TPS1_MPS" \
, "TPS2AB_INITIAL_TPS2EE"
]
......@@ -219,30 +219,25 @@ class TPS2(_tpsx.TPSX, \
or self.parameters.maxwellCoupling == "strayField" ):
self._Mag.v.hs.SetZero()
# assemble blf and lf
self._Assemble_A_instat()
A = self._A_stat + self._A_instat
itnr = 0
oldIterate = np.array( self._Mag.v.gf.vec.FV() )
diff_gf = GridFunction(self._X)
diff_cf = diff_gf
# assemble blf and lf
self._Assemble_f_fix()
for itnr in range(self._maxiter):
self._Assemble_f_iter()
f = self._f_fix.vec.FV().NumPy() + self._f_iter.vec.FV().NumPy()
self._Compute_Q()
LHS = self._Q.dot( A.dot( self._Q.transpose() ) )
RHS = self._Q.dot( f )
w, succ = scipy.sparse.linalg.gmres(LHS, RHS , x0=None \
, tol=self._solvetol, maxiter=4000, M=None)
self._Mag.v.gf.vec.FV().NumPy()[:] = self._Q.transpose().dot(w)
self._UpdateGuess()
self._solution, succ = scipy.sparse.linalg.gmres(self._LHS, RHS , x0=self._guess \
, tol=self._solvetol, maxiter=4000, M=self._preconditioner)
self._Mag.v.gf.vec.FV().NumPy()[:] = self._Q.transpose().dot(self._solution)
diff_gf.vec.FV().NumPy()[:] = self._Mag.v.gf.vec.FV().NumPy()-oldIterate
itError = sqrt( Integrate(diff_cf*diff_cf, self._GetMesh()) )
......@@ -264,6 +259,12 @@ class TPS2(_tpsx.TPSX, \
print("itnr = ", itnr, "; Err = ", itError)
#------------------------------------------------------------------------------#
def _ComputeRHS(self): pass
#------------------------------------------------------------------------------#
......
......@@ -111,7 +111,6 @@ class TPS2AB(tps2.TPS2, _forms.lf_old.LinearForms_Old):
self._ab_f += SymbolicLFI(rhs_ab_cf.Compile(realcompile=True, wait=True))
#------------------------------------------------------------------------------#
......@@ -130,6 +129,14 @@ class TPS2AB(tps2.TPS2, _forms.lf_old.LinearForms_Old):
self._UpdateGuess()
#------------------------------------------------------------------------------#
def _ComputeRHS(self):
from . import _tpsx
_tpsx.TPSX._ComputeRHS(self)
#------------------------------------------------------------------------------#
......
### TPS2+AB + TPS2EE for first time step ###
from . import tps2ab
################################################################################
class TPS2AB_INITIAL_TPS2EE(tps2ab.TPS2AB):
'''
implements TPS2AB from second time-step on,
BUT: At first time step use TPS2EE = EE approximation of pi, i.e., pi(v) := 0
'''
#------------------------------------------------------------------------------#
def _DerivLinearTerms_pi_Implicit_RHS(self):
return self._ZeroCF()
#------------------------------------------------------------------------------#
################################################################################
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment