Esempio n. 1
0
p2 = 3  # spline degree
ne1 = 16  # number of elements
ne2 = 16

print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
print('Simulation with Ncells :=', '[', ne1, 'X', ne2, ']', ' Spline degree =',
      p1)
print(
    '---------------------------------------------------------------------------'
)

grid1 = linspace(-1, 1., ne1 + 1)
grid2 = linspace(-1, 1., ne1 + 1)
knots1 = make_knots(grid1, p1, periodic=False)
knots2 = make_knots(grid2, p2, periodic=False)
spans1 = elements_spans(knots1, p1)
spans2 = elements_spans(knots2, p2)

######################################################
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)
Esempio n. 2
0
#grid=newgrid(grid1,alpha) 
#--------------------------------------------
#grid=np.array([-1. , -0.876,-0.69, -0.685,-0.31, -0.305, -0.064,  0.35 ,0.351,  0.64,  1. ])
#grid=np.array([-1. , -0.8997,-0.79992, -0.3306,-0.2002, -0.10001, -0.005,  0.1003 ,0.199,  0.8503,  1. ])
grid=np.array([-1. , -0.9097,-0.8002, -0.3306,-0.2002, -0.10001, 0.0,  0.1003 ,0.200,  0.8503,  1. ])
#grid=np.array([-1. , -0.986,-0.895, -0.775,-0.431, -0.4001, -0.164,  0.235 ,0.251,  0.54,  1. ])
#--------------------------------------------------
# ===========================uniform subdivision===============================    
#----------------------------------------------
#grid  = linspace(-1., 1., ne+1)
#-----------------------------------------------
# ==========================================================


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 )