###################################################### nelements1 = len(grid1) - 1 nelements2 = len(grid2) - 1 nbasis1 = len(knots1) - p1 - 1 nbasis2 = len(knots2) - p2 - 1 # we need the value a B-Spline and its first derivative nderiv = 1 # create the gauss-legendre rule, on [-1, 1] u1, w1 = gauss_legendre(p1) u2, w2 = gauss_legendre(p2) # for each element on the grid, we create a local quadrature grid points1, weights1 = quadrature_grid(grid1, u1, w1) points2, weights2 = quadrature_grid(grid1, u1, w2) # for each element and a quadrature points, # we compute the non-vanishing B-Splines basis1 = basis_ders_on_quad_grid(knots1, p1, points1, nderiv) basis2 = basis_ders_on_quad_grid(knots2, p2, points2, nderiv) #Start a time import time start = time.time() ####################################################### stiffness = zeros((nbasis1, nbasis1, nbasis2, nbasis2)) stiffness = assemble_stiffness((nelements1, nelements2), (p1, p2), (spans1, spans2), (basis1, basis2), (weights1, weights2), (points1, points2),
# ========================================================== knots = make_knots(grid, p, periodic=False) spans = elements_spans(knots, p) nelements = len(grid) - 1 nbasis = len(knots) - p - 1 # we need the value a B-Spline and its first derivative nderiv = 1 # create the gauss-legendre rule, on [-1, 1] u, w = gauss_legendre( p ) # for each element on the grid, we create a local quadrature grid points, weights = quadrature_grid( grid, u, w ) # for each element and a quadrature points, # we compute the non-vanishing B-Splines basis = basis_ders_on_quad_grid( knots, p, points, nderiv ) stiffnessM = zeros((nbasis, nbasis)) stiffnessM = assemble_stiffnessM(nelements, p, spans, basis, weights, points, matrix=stiffnessM) stiffnessN = zeros((nbasis, nbasis)) stiffnessN = assemble_stiffnessN(nelements, p, spans, basis, weights, points, matrix=stiffnessN) f = lambda x: 1 rhs = zeros(nbasis) rhs = assemble_rhs(f, nelements, p, spans, basis, weights, points, rhs=rhs) # apply homogeneous dirichlet boundary conditions #-----------------------------------------------