In [1]:
import scipy.io
from scipy2Trilinos import scipy_csr_matrix2CrsMatrix
from PyTrilinos import Epetra, ML, AztecOO
import TrilinosIO
System = scipy.io.loadmat("System.mat")
MLList = {
"default values":"maxwell",
"max levels":10,
"prec type":"MGV",
"increasing or decreasing":"decreasing",
"aggregation: type":"Uncoupled-MIS",
"aggregation: damping factor":1.333,
"eigen-analysis: type":"cg",
"eigen-analysis: iterations":10,
"aggregation: edge prolongator drop threshold":0.0,
"smoother: sweeps":1,
"smoother: damping factor":1.0,
"smoother: pre or post":"both",
# "smoother: type":"Hiptmair",
"smoother: Hiptmair efficient symmetric":True,
"subsmoother: type": "Chebyshev",
"subsmoother: Chebyshev alpha": 20.0,
"subsmoother: node sweeps":4,
"subsmoother: edge sweeps":4,
"coarse: type":"Amesos-KLU",
"coarse: max size":128,
"coarse: pre or post":"post",
"coarse: sweeps":1
}
comm = Epetra.PyComm()
C = scipy_csr_matrix2CrsMatrix(System["C"].tocsr(), comm)
CurlCurl = scipy_csr_matrix2CrsMatrix(System["CurlCurl"].tocsr(), comm)
node = scipy_csr_matrix2CrsMatrix(System["node"].tocsr(), comm)
In [3]:
ML_Hiptmair = ML.MultiLevelPreconditioner(CurlCurl,C,node,MLList)
ML_Hiptmair.ComputePreconditioner()
Out[3]:
In [4]:
x = System["rhs"][0]
In [6]:
x
b_epetra = TrilinosIO._numpyToTrilinosVector(x)