|
| 1 | +module JacobiPolynomialBasisTests |
| 2 | + |
| 3 | +using Test |
| 4 | +using Gridap.TensorValues |
| 5 | +using Gridap.Fields |
| 6 | +using Gridap.Fields: Broadcasting |
| 7 | +using Gridap.Polynomials |
| 8 | + |
| 9 | +# Real-valued Q space with isotropic order |
| 10 | + |
| 11 | +x1 = Point(0.0) |
| 12 | +x2 = Point(0.5) |
| 13 | +x3 = Point(1.0) |
| 14 | + |
| 15 | +V = Float64 |
| 16 | +G = gradient_type(V,x1) |
| 17 | +H = gradient_type(G,x1) |
| 18 | + |
| 19 | +order = 3 |
| 20 | +b1 = JacobiPolynomialBasis{1}(V,order) |
| 21 | +∇b1 = Broadcasting(∇)(b1) |
| 22 | +∇∇b1 = Broadcasting(∇)(∇b1) |
| 23 | + |
| 24 | +@test evaluate(b1,[x1,x2,x3,]) ≈ [ 1.0 -1.7320508075688772 2.23606797749979 -2.6457513110645907; |
| 25 | + 1.0 0.0 -1.118033988749895 -0.0; |
| 26 | + 1.0 1.7320508075688772 2.23606797749979 2.6457513110645907 ] |
| 27 | +@test evaluate(∇b1,[x1,x2,x3,]) ≈ G[ (0.0,) (3.4641016151377544,) (-13.416407864998739,) (31.74901573277509,); |
| 28 | + (0.0,) (3.4641016151377544,) (0.0,) (-7.937253933193772,); |
| 29 | + (0.0,) (3.4641016151377544,) (13.416407864998739,) (31.74901573277509,) ] |
| 30 | +@test evaluate(∇∇b1,[x1,x2,x3,]) ≈ H[ (0.0,) (0.0,) (13.416407864998739,) (-79.37253933193772,); |
| 31 | + (0.0,) (0.0,) (13.416407864998739,) (0.0,); |
| 32 | + (0.0,) (0.0,) (13.416407864998739,) (79.37253933193772,) ] |
| 33 | + |
| 34 | +x1 = Point(0.0,0.0) |
| 35 | +x2 = Point(0.5,0.5) |
| 36 | +x3 = Point(1.0,1.0) |
| 37 | +b2 = JacobiPolynomialBasis{2}(V,order) |
| 38 | +∇b2 = Broadcasting(∇)(b2) |
| 39 | +∇∇b2 = Broadcasting(∇)(∇b2) |
| 40 | + |
| 41 | +G = gradient_type(V,x1) |
| 42 | +H = gradient_type(G,x1) |
| 43 | + |
| 44 | +@test evaluate(b2,[x1,x2,x3,]) ≈ [ 1.0 -1.7320508075688772 2.23606797749979 -2.6457513110645907 #= |
| 45 | + =# -1.7320508075688772 2.9999999999999996 -3.872983346207417 #= |
| 46 | + =# 4.58257569495584 2.23606797749979 -3.872983346207417 #= |
| 47 | + =# 5.000000000000001 -5.916079783099617 -2.6457513110645907 #= |
| 48 | + =# 4.58257569495584 -5.916079783099617 7.000000000000001; |
| 49 | + 1.0 0.0 -1.118033988749895 -0.0 0.0 0.0 -0.0 -0.0 #= |
| 50 | + =# -1.118033988749895 -0.0 1.2500000000000002 0.0 -0.0 -0.0 0.0 0.0; |
| 51 | + 1.0 1.7320508075688772 2.23606797749979 2.6457513110645907 #= |
| 52 | + =# 1.7320508075688772 2.9999999999999996 3.872983346207417 #= |
| 53 | + =# 4.58257569495584 2.23606797749979 3.872983346207417 #= |
| 54 | + =# 5.000000000000001 5.916079783099617 2.6457513110645907 #= |
| 55 | + =# 4.58257569495584 5.916079783099617 7.000000000000001 ] |
| 56 | +@test evaluate(∇b2,[x1,x2,x3,])[:,10] ≈ G[ (7.745966692414834, 23.2379000772445); |
| 57 | + (-3.872983346207417, 0.0); |
| 58 | + (7.745966692414834, 23.2379000772445) ] |
| 59 | +@test evaluate(∇∇b2,[x1,x2,x3,])[:,10] ≈ H[ (0.0, -46.475800154489, -46.475800154489, -23.2379000772445); |
| 60 | + (-0.0, 0.0, 0.0, 0.0); |
| 61 | + (0.0, 46.475800154489, 46.475800154489, 23.2379000772445) ] |
| 62 | + |
| 63 | +end # module |
0 commit comments