· notes · 6 min read
Reconstructed 1D basis functions for `P2r/P2r`
Constructing the reconstructed basis through the linear reconstruction operator from vertex degrees of freedom to full quadratic degrees of freedom.
In this work, the reconstructed basis is not introduced analytically first. Instead, we define a linear reconstruction operator from vertex degrees of freedom to full quadratic degrees of freedom. The reconstructed basis functions are then obtained from the columns of this operator.
Reconstruction procedure
function midpoints_periodic(x::AbstractVector, u::AbstractVector; chi=0.0)
N = length(x)
ux, uxx = recover_derivatives_periodic(x, u)
um = zeros(eltype(u), N)
for e in 1:N
ep = modp(e, N) + 1
h = (e < N) ? (x[e+1] - x[e]) : (1.0 - x[e] + x[1])
UL = u[e] + (h/2)*ux[e] + (h^2/8)*uxx[e]
UR = u[ep] - (h/2)*ux[ep] + (h^2/8)*uxx[ep]
um[e] = (0.5 + chi)*UL + (0.5 - chi)*UR
end
return um
end
function build_reconstruction_matrix_periodic(x::AbstractVector; chi=0.0)
N = length(x)
nv = N
ndof_full = 2N
vid(j) = modp(j, N) + 1
midid(e) = N + e
rows = Int[]
cols = Int[]
vals = Float64[]
for j in 0:N-1
push!(rows, vid(j))
push!(cols, j+1)
push!(vals, 1.0)
end
for k in 1:nv
ek = zeros(Float64, nv)
ek[k] = 1.0
um = midpoints_periodic(x, ek; chi=chi)
for e in 1:N
wk = um[e]
if abs(wk) > 0.0
push!(rows, midid(e))
push!(cols, k)
push!(vals, wk)
end
end
end
return sparse(rows, cols, vals, ndof_full, nv)
end1. Periodic 1D setting
Consider a periodic mesh with vertices
and cells
with periodic indexing. On the last cell, we have
if the periodic domain is identified with .
In one space dimension, a continuous quadratic finite element space has:
- one degree of freedom at each vertex,
- one degree of freedom at each cell midpoint.
Hence, the full quadratic representation has degrees of freedom.
2. Reconstruction of midpoint values
Let
denote the vector of vertex values.
From these values, we first recover approximations of the first and second derivatives at the vertices,
through
ux, uxx = recover_derivatives_periodic(x, u)On each cell of size
Then, we form two quadratic Taylor approximations of the midpoint value.
The left-based approximation is
while the right-based approximation is
The reconstructed midpoint value is then defined by
For , this gives the symmetric average of the two midpoint predictions. For , the reconstruction is biased.
3. Reconstruction operator
The previous construction is linear with respect to the vertex vector . Therefore, it defines a linear operator
such that
where is the vector of full quadratic degrees of freedom,
The first rows of simply copy the vertex values, while the last rows provide the reconstructed midpoint values. Hence, can be written as
where:
- is the identity matrix,
- maps vertex values to reconstructed midpoint values.
Equivalently,
4. Construction of the matrix
Since the reconstruction is linear, the matrix is obtained by applying the reconstruction to the canonical basis vectors of .
Let
be the -th canonical basis vector. Then the -th column of is given by the reconstructed full quadratic vector associated with .
In the code, this is done by
ek = zeros(Float64, nv)
ek[k] = 1.0
um = midpoints_periodic(x, ek; chi=chi)The first block of the column is itself, since the vertex values are copied. The second block is the vector of reconstructed midpoint values obtained from .
Thus, the -th column of is
This is exactly what the routine build_reconstruction_matrix_periodic assembles.
5. Reconstructed basis functions
Let denote the standard global continuous basis, ordered as follows:
- are the vertex basis functions,
- are the midpoint basis functions.
Any function in the full continuous space can be written as
where is the vector of full quadratic degrees of freedom.
In the reconstructed formulation, the dofs are the vertex values , and the full quadratic coefficients satisfy
Therefore,
Reordering the sum with respect to the vertex unknowns gives
where the reconstructed basis functions are defined by
This is the definition of the reconstructed P2r basis.
Using the block decomposition , we immediately get
Hence, each reconstructed basis function consists of:
- its vertex basis contribution ,
- plus a linear combination of midpoint basis functions induced by the reconstruction.
6. Reconstructed space
The reconstructed space is the subspace of the full continuous space for which midpoint degrees of freedom are constrained by the reconstruction from vertex values. It can be written as
A natural basis of this space is given by the reconstructed basis functions .
7. Matrix form of reconstructed operators
Let be any matrix assembled in the full quadratic space, for instance a mass, stiffness, or advection matrix.
Since the reconstructed solution satisfies , the corresponding matrix in the reconstructed vertex space is
Indeed, for two reconstructed vectors and , we have
Thus, the reconstructed operator is obtained by restricting the full operator to the reconstructed subspace. For a mixed operator, we insert on the side corresponding to the reconstructed space. If the trial space is reconstructed and the test space is unchanged, then
If the test space is reconstructed and the trial space is unchanged, then
If both trial and test spaces are reconstructed, then
- from a full
P2/P2matrix , we have - for a mixed operator, we insert on the trial and/or test side as appropriate, e.g.
Summary
Starting from vertex values :
- recover derivative approximations at the vertices,
- use left and right quadratic Taylor expansions to predict midpoint values,
- combine the two predictions with parameter ,
- obtain a linear reconstruction operator
- define the reconstructed basis functions by
- build reconstructed matrices through
In the code, the reconstructed basis functions are never introduced explicitly. They are the basis functions induced by the reconstruction operator.