|
[Sponsors] |
May 12, 2020, 01:05 |
Least approximation of derivative
|
#1 |
Senior Member
|
Greetings,
Recently, I've read some papers in which they are using least-square to approximate the 2bd-order derivatives of a given 1-D data. I couldn't figure out how to do this, and I couldn't find any helpful references online. Can anyone give me some hint, or recommend some references? Appreciate it! Edit: To be more specific, my purpose is to evaluate the following 2nd-order derivative where is just the integer wavenumber, and is a given function in spectral space. Last edited by TurbJet; May 12, 2020 at 23:04. |
|
May 12, 2020, 01:52 |
|
#2 | |
Senior Member
Troy Snyder
Join Date: Jul 2009
Location: Akron, OH
Posts: 220
Rep Power: 19 |
Quote:
|
||
May 12, 2020, 05:32 |
|
#3 |
Senior Member
|
The general idea is that you write a 1st order taylor series approximation of a variable phi in the neighborhood n of the point c where you need the gradient (it is used for gradients in general) and assume that:
phi_n = phi_c + dphi/dx_i * (x_n-x_c)_i Write this for all the available neighbors of a given point c and you get a system of equations that, in most cases, needs to be solved by a least squares method because you have more neighbors than gradient components. However, the exact least squares solution of the equations is available and you don't typically solve it by a numerical procedure. There is abundant literature on this. I suggest the book by Blazek as textbook reference because it is the one that covers it best (he and Haselbacher actually developed one of the available closed solutions to the problem). EDIT: a different version of the exact solution (basically, you have the one based on solving the normal equations and the one based on QR factorization) can also be found in several of the early works of Prof. Z. J. Wang but, unfortunately, each one of them has a slight little error, and you need to look at all of them together to catch it. Let me also highlight that the work of Blazek and Haselbacher is more general and has, indeed, been extended to higher than first order approximations (used for k-exact rexonstructions) as well as to filters for unstructured grids. Doru Caraeni also put forward some developments/derivations for the easy application for 3rd order codes Finally, Nishikawa and coworkers have also made several studies recently Last edited by sbaffini; May 12, 2020 at 09:23. |
|
May 12, 2020, 14:20 |
|
#4 |
Senior Member
-
Join Date: Jul 2012
Location: Germany
Posts: 184
Rep Power: 14 |
Or you simply use this slide:
edit: By the way it is called Least Squares! |
|
May 12, 2020, 22:37 |
|
#5 |
Senior Member
|
Maybe, but I am not sure. The paper I read is using this least-squares approximation to approximate the 2nd-order derivative of the energy flux of HIT in spectral space. The reason they're using this is because the underlying grid is non-uniform.
|
|
May 12, 2020, 22:42 |
|
#6 |
Senior Member
|
Is this applicable to 1D case? I am just looking for an approach to differentiate a function on a non-uniform grid. The paper I referred to use this least-squares approximation to find out the 2nd-derivative of a given dataset.
|
|
May 12, 2020, 22:49 |
|
#7 | |
Senior Member
|
Quote:
|
||
May 13, 2020, 03:19 |
|
#8 | ||
Senior Member
-
Join Date: Jul 2012
Location: Germany
Posts: 184
Rep Power: 14 |
Quote:
Quote:
and therefore . This is more easy to discretisize. Regards Last edited by Eifoehn4; May 13, 2020 at 05:43. |
|||
May 13, 2020, 07:10 |
|
#9 |
Senior Member
|
Quote:
for a function of the form , representative of the energy at large large scales (i.e., no dissipative range). When you look at this in log k the peak is much more spread (besides the fact that the delta log(k) are much smaller than the delta k). However, without knowing the original use case for least squares here, Ferziger & Peric has straighforward formulas for both 1st and 2nd derivatives in 1D for non uniform grids, without need to resort to anything fancy. |
|
May 13, 2020, 08:02 |
|
#10 |
Senior Member
-
Join Date: Jul 2012
Location: Germany
Posts: 184
Rep Power: 14 |
Quote:
|
|
May 13, 2020, 16:29 |
|
#11 |
Senior Member
|
||
May 13, 2020, 16:37 |
|
#12 |
Senior Member
|
Quote:
|
|
May 13, 2020, 17:18 |
|
#13 |
Senior Member
|
Well, the function I used is just an example of how the energy spectra behave at low wave numbers (I used k^4, but k^2 would have been another possibility), where they tipically have a peak.
Now, what approach is more suited obviously depends from what the final goal is, but I would point out the following: 1) The formula with log k is just a second derivative, while the formula with k has two derivatives (first and second) multiplied by k and k^2 respectively. More work and typically more error. 2) The steps in k are much larger than those in log k, so this is necessarily linked to higher error 3) Now that I think more about it, this might simply be a restatement of 2 but, if you plot the function above as function of k and of log k, the latter is much more smoother around the peak, which means that any given formula would give less error. When I wrote the message this morning, I actually tried both formulas and they indeed differ at low wavenumbers for the function I mentioned. I deleted the script I used, but I suggest you to make a similar test to better understand them both. |
|
May 13, 2020, 19:08 |
|
#14 | |
Senior Member
|
Quote:
|
||
Tags |
derivative, least-squares, numerical analysis, numerical method |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error when calculating the second derivative using the derivative function d2dy2 | mona.li | Tecplot | 0 | July 8, 2018 15:11 |
Time derivative of pressure in low mach number approximation | hnemati | Main CFD Forum | 1 | June 16, 2016 08:05 |
Tangential derivative on curved boundary | Simbelmynė | Main CFD Forum | 40 | October 14, 2014 07:57 |
discontinuous second derivative | new_at_this | Main CFD Forum | 9 | April 28, 2012 17:55 |
Different one sided derivative approximation? | zonexo | Main CFD Forum | 2 | January 11, 2006 05:40 |