Errors in Function.extrapolate with Interval Lagrange elements
I've been testing extrapolate for interpolation purposes and noticed what appears to be a bug (code below). When extrapolating more than one order higher in interpolation levels (say Lagrange order 1 to Lagrange order 3) oscillations appear in the extrapolated higher order function.
The following is a test code which generates data for y=x^5 at non-regular intervals, x_i = i*(1+*0.1), and tests extrapolating the data to higher basis functions at x=3. The following is the output:
3^5 : 243 <--- expected
O(1): 298.676 O(2): 228 O(3): 234.062 O(4): 88.9269
Note that the values start to diverge. The errors behave differently with different data and testing points, but this demonstrates the problem.
The UFL files look like:
element = FiniteElement(
element = FiniteElement(
element = FiniteElement(
element = FiniteElement(
Here's the code:
// Setup data vectors
int n = 9;
// Setup data vectors
boost:
boost:
// Populate test data
for(int i=0; i<n; i++)
{
xs->setitem(
ys->setitem(
}
// Setup the mesh to interpolate on
// Note the count is the number of elements, not nodes
boost:
for(int i=0; i<n; i++)
mesh->
// create the function space of order one.
// this is done so that dof maps directly to
// data points.
boost:
(new Interpolate1:
// copy the data into the function space
Function fy (V, ys);
boost:
(new Interpolate2:
boost:
(new Interpolate3:
boost:
(new Interpolate4:
Function fy2 (V2);
Function fy3 (V3);
Function fy4 (V4);
fy2.extrapolat
fy3.extrapolat
fy4.extrapolat
std::cout << "3^5 : " << 3*3*3*3*3 << "\n"
<< "O(1): " << fy(3)
<< "\tO(2): " << fy2(3)
<< "\tO(3): " << fy3(3)
<< "\tO(4): " << fy4(3)
<< "\n";
Thoughts?
Question information
- Language:
- English Edit question
- Status:
- Expired
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: