- Thank you received: 0
Basis Functions and Interpolation
- oliverxia2020
- Topic Author
- Offline
- New Member
Less
More
4 years 2 months ago #3114
by oliverxia2020
Basis Functions and Interpolation was created by oliverxia2020
Dear NGSolve community,
I am new to NGSolve and I'd like to ask two basic questions.
1. How can I get the ordering of the basis functions on each element?
I know we can use
to get the DOF number for each element. But I wonder how can I know what basis function corresponds to a given DOF. For example, I am using L2 space for quadrilateral meshes. I know the L2 space uses a tensor product of Legendre Polynomials in x and y directions. But I notice that in some elements, the basis functions are ordering like 1, y, x, x*y...., while in some other element, they are ordering like 1, x, y, x*y. Is there an easy way to know the ordering of the basis functions in each element?
2. Can I do interpolation with a set of points?
I know we can use GridFunction.Set to interpolate a CoefficientFunction, but I wonder if I have a set of points and values (x_i, y_i, eval_i), can I interpolate (or do least squares) to an element in the finite element space?
Thank you for answering my questions.
Best,
Oliver
I am new to NGSolve and I'd like to ask two basic questions.
1. How can I get the ordering of the basis functions on each element?
I know we can use
Code:
fes.GetDofNrs(el)
2. Can I do interpolation with a set of points?
I know we can use GridFunction.Set to interpolate a CoefficientFunction, but I wonder if I have a set of points and values (x_i, y_i, eval_i), can I interpolate (or do least squares) to an element in the finite element space?
Thank you for answering my questions.
Best,
Oliver
4 years 2 months ago #3115
by joachim
Replied by joachim on topic Basis Functions and Interpolation
Hi Oliver,
the transformation from local coordinates to global coordinates depends on the element vertex numbers. This ensures consistent orientation on edges and faces.
It would not be necessary for L2, but we made L2 consistent with the other spaces.
See Sabine's thesis:
www.numa.uni-linz.ac.at/Teaching/PhD/Finished/zaglmayr-diss.pdf
around page 66
Or have a look directly into the code:
github.com/NGSolve/ngsolve/blob/master/fem/l2hofe_impl.hpp
line 403 is the L2-quad
The face f is ordered with the vertex numbers, f[0] becomes the smallest.
Here is a pure Python-solution for least squares approximation of arbitrary point data.
If you need performance, you can recode the same in C++.
If you want to interpolate data from a structured grid, you can use the VoxelCoefficientFunction.
If your interpolation points are given on the reference element, you can use user-defined integration-rules.
best,
Joachim
the transformation from local coordinates to global coordinates depends on the element vertex numbers. This ensures consistent orientation on edges and faces.
It would not be necessary for L2, but we made L2 consistent with the other spaces.
See Sabine's thesis:
www.numa.uni-linz.ac.at/Teaching/PhD/Finished/zaglmayr-diss.pdf
around page 66
Or have a look directly into the code:
github.com/NGSolve/ngsolve/blob/master/fem/l2hofe_impl.hpp
line 403 is the L2-quad
The face f is ordered with the vertex numbers, f[0] becomes the smallest.
Here is a pure Python-solution for least squares approximation of arbitrary point data.
If you need performance, you can recode the same in C++.
If you want to interpolate data from a structured grid, you can use the VoxelCoefficientFunction.
If your interpolation points are given on the reference element, you can use user-defined integration-rules.
best,
Joachim
Attachments:
The following user(s) said Thank You: oliverxia2020
- oliverxia2020
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
4 years 2 months ago #3117
by oliverxia2020
Replied by oliverxia2020 on topic Basis Functions and Interpolation
Hi Joachim
Thank you for your reply. I understand them now.
Best,
Oliver
Thank you for your reply. I understand them now.
Best,
Oliver
Time to create page: 0.117 seconds