Skip to content

Conversation

@TaigoFr
Copy link
Member

@TaigoFr TaigoFr commented Jul 21, 2021

Cubic Spline is an interpolator that is quick and useful for 1D data. The Lagrange class could be used for interpolating 1D data, but Cubic Spline allows easily for non-uniform spacing 1D grid. This then can be used to interpolate data that exist in params.txt via the FileInterpolator1D. For instance, I have used this to solve 1D constraints in spherical symmetry elsewhere and then importing the data to the 3D grid.

It requires a matrix inversion, and that is done by a LU solver with the TriDiagonalMatrix class.

Two tests added. CubicSplineInterpolatorTest, to test the cubic spline interpolation, and FileInterpolator1DTest, to test the importing of file data to interpolate. The later can be also useful as an example of how to use these classes.

If "N", "x" and "y" are set in a separate file 'fileWithData.txt', one easy way to import them to the 'params.txt' without changing the file is running with the command:
'Main.ex params.txt FILE=fileWithData.txt'

I had this around my code and @mirenradia said it could be a nice addition, so I'll mark him as reviewer :P

Cubic Spline is an interpolator that is quick and useful for 1D data. The Lagrange class could be used for interpolating 1D data, but Cubic Spline allows easily for non-uniform spacing 1D grid. This then can be used to interpolate data that exist in params.txt via the FileInterpolator1D. For instance, I have used this to solve 1D constraints in spherical symmetry elsewhere and then importing the data to the 3D grid.

It requires a matrix inversion, and that is done by a LU solver with the TriDiagonalMatrix class.

Two tests added. CubicSplineInterpolatorTest, to test the cubic spline interpolation, and FileInterpolator1DTest, to test the importing of file data to interpolate. The later can be also useful as an example of how to use these classes.

If "N", "x" and "y" are set in a separate file 'fileWithData.txt', one easy way to import them to the 'params.txt' without changing the file is running with the command:
'Main.ex params.txt FILE=fileWithData.txt'
@TaigoFr TaigoFr requested a review from mirenradia July 21, 2021 10:31
@mirenradia mirenradia added the enhancement Modification of existing feature/general improvement label Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Modification of existing feature/general improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants