Last active
June 7, 2020 19:52
-
-
Save c-f-h/1558b237a95eb88a0eaaa078a8a94f93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from pyiga import bspline, geometry, assemble, approx | |
def L2ErrEstimator_vf(dim): | |
from pyiga.vform import VForm, div, grad, dx, tree_print | |
vf = VForm(dim, arity=1) | |
u = vf.input('u') | |
v = vf.basisfuns() | |
Lu = div(grad(u, parametric=True), parametric=True) | |
vf.add(Lu**2 * v * dx) | |
return vf | |
kvs = 2 * (bspline.make_knots(2, 0.0, 1.0, 10),) | |
#geo = geometry.quarter_annulus() | |
geo = geometry.unit_square() | |
n = kvs[0].numdofs | |
u = bspline.BSplineFunc(kvs, approx.interpolate(kvs, lambda x,y: x**2 + 0.5*y**2)) | |
# space of piecewise constants over the cells of the mesh | |
kvs_0 = 2 * (bspline.make_knots(0, 0.0, 1.0, 10),) | |
errors = assemble.assemble_vf(L2ErrEstimator_vf(2), kvs_0, geo=geo, u=u) | |
print(errors) | |
print(np.sum(errors)) | |
~ ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment