Skip to content

FunctionValues with VectorInterpolation are not initialized #1163

@gijswl

Description

@gijswl

While using write_solution to save a vector solution to a vtk file, I found that all exported data is zero. Scalar solutions are exported properly. After some digging, I found that function_value was returning different results for a VectorInterpolation than for a ScalarInterpolation in the context of evaluate_at_grid_nodes. This is only an issue at this point in the code because reinit! is not used during the evaluation.

The following example reproduces the issue

qr = QuadratureRule{RefTriangle}(2)
ip_geo = Lagrange{RefTriangle, 1}()

cv_scalar = CellValues(qr, Lagrange{RefTriangle, 1}(), ip_geo)
cv_vector = CellValues(qr, Nedelec{RefTriangle, 1}(), ip_geo)

Then for the scalar interpolation we get, as expected

julia> cv_scalar.fun_values.Nξ
3×3 Matrix{Float64}:
 0.166667  0.166667  0.666667
 0.166667  0.666667  0.166667
 0.666667  0.166667  0.166667

julia> cv_scalar.fun_values.Nx
3×3 Matrix{Float64}:
 0.166667  0.166667  0.666667
 0.166667  0.666667  0.166667
 0.666667  0.166667  0.166667

whereas for the vector interpolation, we get an uninitialized Nx

julia> cv_vector.fun_values.Nξ
3×3 Matrix{Vec{2, Float64}}:
 [-0.166667, 0.166667]   [-0.666667, 0.166667]   [-0.166667, 0.666667]
 [-0.166667, -0.833333]  [-0.666667, -0.833333]  [-0.166667, -0.333333]
 [0.833333, 0.166667]    [0.333333, 0.166667]    [0.833333, 0.666667]

julia> cv_vector.fun_values.Nx
3×3 Matrix{Vec{2, Float64}}:
 [1.36288e-311, 1.36244e-311]  [1.36244e-311, 1.3629e-311]  [0.0, 0.0]
 [1.3629e-311, 1.36232e-311]   [1.3629e-311, 1.3629e-311]   [0.0, 0.0]
 [1.36244e-311, 1.36244e-311]  [1.36244e-311, 0.0]          [0.0, 0.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions