Пример #1
0
"""

print(__doc__)

theta = float(sys.argv[1])
maxit = int(sys.argv[2])
step = int(sys.argv[3])

info = """
theta : %f
maxit : %d
 step : %d
""" % (theta, maxit, step)
print(info)

pde = LShapeRSinData()

model = EllipticEignvalueFEMModel(pde,
                                  theta=theta,
                                  maxit=maxit,
                                  step=step,
                                  n=3,
                                  p=1,
                                  q=3)

u0 = model.alg_0()
u1 = model.alg_1()
u2 = model.alg_2()
u3 = model.alg_3()
u4 = model.alg_4()
                    default='log',
                    type=str,
                    help='自适应类型,默认为 log 策略.')

parser.add_argument('--maxdof',
                    default=200000,
                    type=int,
                    help='默认网格自适应加密最大自由度个数, 默认最大自由度个数为 200000')

args = parser.parse_args()

theta = args.theta
maxdof = args.maxdof
atype = args.atype

pde = LShapeRSinData()

tritree = pde.init_mesh(n=4, meshtype='tritree')

errorType = ['$|| u - u_h||_{0}$', '$||\\nabla u - \\nabla u_h||_{0}$']

NDof = []
errorMatrix = [[], []]

k = 0
while True:
    mesh = tritree.to_conformmesh()

    fname = './test-' + str(k) + '.png'
    mesh.add_plot(plt)
    plt.savefig(fname)
#

import numpy as np
import matplotlib.pyplot as plt

from scipy.sparse.linalg import spsolve
import pyamg

from fealpy.pde.poisson_2d import LShapeRSinData
from fealpy.functionspace import LagrangeFiniteElementSpace
from fealpy.boundarycondition import DirichletBC

from fealpy.mesh.adaptive_tools import mark
from fealpy.tools.show import showmultirate

pde = LShapeRSinData()
mesh = pde.init_mesh(n=4, meshtype='tri')

theta = 0.2
maxit = 40
p = 1
errorType = [
    '$|| u - u_h||_{0}$', '$||\\nabla u - \\nabla u_h||_{0}$',
    '$||\\nabla u - G(\\nabla u_h)||_{0}$',
    '$||\\nabla u_h - G(\\nabla u_h)||_{0}$'
]

NDof = np.zeros((maxit, ), dtype=np.int_)
errorMatrix = np.zeros((len(errorType), maxit), dtype=np.float64)

mesh.add_plot(plt)