Está en la página 1de 9

Application of Kalman filter for reduction of error in variables passed from a

ODT to LES
Shubham Srivastava

000959606

1) Problem Statement
For coupling Large Eddy Simulation (LES) equations with 1-D stochastic governing equations of One
Dimensional Turbulence (ODT) data has to be passed from one scale to the other. The data passed
contributes directly to the accuracy of the solution. The ODT solutions also constitute statistical data
whose behavior over all scales depends on its density i.e. the number of ODT points embedded in one
LES cell. Therefore these values being passed should be spectrally smooth. For this purpose Kalman
Filter is used to refine the density values to obtain more accurate solutions. Here a more generic problem
has been formulated using Continuity equation and Burger’s equation and Kalman filter has been
implemented on that to prove its efficacy. Similar to the LES – ODT case, here too the density predicted
by the continuity equation has to be refined.

2) Problem with the initial solution


Earlier Box Filtering was used to calculate the mean value of the density in the LES cell. This was
nothing but just a spacial average of all the ODT values and therefore it did not represent the entire cell
but served just as an approximation which wasn’t very close to the true value.

3) Kalman Filter
The Kalman filter is an optimal solution for data prediction and smoothing tasks. It is a recursive filter
that estimates the internal state of a linear system for a series of noisy measurements. Here a short
explanation is provided on the derivation and the use of Kalman Filter.

Let um be a random vector whose dynamics is given by the equation –

um+1 = F um + σm+1 (1)

The goal of Kalman filter is to estimate the unknown true state um+1 and σ is a Gaussian noise.

r is the covariance of the noise i.e. r = <σm,σmT>

The noisy observations are given by-

vm+1 = g um+1 + σm+1ο (2)

rο is the covariance of the observation noise i.e. ro = <σmο,σmοT>

The error distribution of conditional probability of observation state given the estimated state is a
Gaussian distribution. Therefore the mean of the observation state from (2) is gum+1. Hence

p(vm+1|um+1) ~ N(gum+1 , rο) (3)

To estimate the prior state we use the model-

um+1|m = F um|m + σm+1 (4)

Shubham Srivastava 000959606 Page 1


where um+1|m is the prior state i.e. before the knowledge of the observation

um|m is the the posterior state after observation at time m

Now p(um+1) ~ N(ūm+1|m , rm+1|m) (5)

where

ūm+1|m = F ūm|m (6)

rm+1|m = F rm|m FT + r (7)

and

rm|m = <(um – ūm|m)(um – ūm|m)T> which is the state error covarience (8)

To get the estimate of the true value after the knowledge of observation at that time

p(um+1|vm+1) ~ p(um+1) p(vm+1|um+1) (9)

Using (3) and (5) and writing the probabilities as Gaussian distributions-

૚ ି(࢞ିࣆ)૛
exp 
ඥ૛࣊࣌ ૛ ૛࣌૛

where µ is the mean and σ is the covariance of the distribution we get


ିࡶ(࢛࢓ା૚)
 ૛

and to maximize the above probability we need to minimize-

J(u) = ((u – ūm+1|m)T (u – ūm+1|m)) / rm+1|m + ((vm+1 – gu)T (vm+1 – gu)) / rο (10)

The value of u at which J(u) attains its minimum is-

ūm+1|m+1 = ūm+1|m + Km+1 (vm+1 – gūm+1|m) (11)

where Km+1 = (grm+1|m) / (rο + g2rm+1|m) is the Kalman gain (12)

and finally rm+1|m+1 = (1 – Km+1g) rm+1|m (13)

Now everything is again repeated from equation (6) to (13) until the last time step.

Shubham Srivastava 000959606 Page 2


4) Outline of the Scheme

For solving the problem a discrete Kalman Filter has been used. An initial density field was initialized
along with a velocity field. Random errors were added to the density field and after applying Kalman
filter the cleaner density was obtained. The velocity field was then advanced using this clean density.

The literature explains the solution in three parts-

• The first part illustrates how the actual density field would advance theoretically if there were no
errors.

• The second part shows how the density field would advance if the errors were not cleaned after
being introduced.

• The third part explains the entire Kalman filter algorithm and how it is used on the erroneous
density field to get out a refined density which is then used to further the velocity field.

And later all the different scenarios are then compared.

5) Scheme
Equations used-

=૙
ࣔ࣋ ࣔ(࢛࣋)
+ (14)
࢚ࣔ ࣔ࢞
Equation 14 is the Continuity Equation. A density grid of n x 3 was generated. The equation 14 was
discretized using the central difference scheme as given below.

࣋࢔ା૚ = ࣋࢔࢏ - ቀ ቁ ሺ࣋࢔࢏ା૚ ࢛࢔࢏ା૚ − ࣋࢔࢏ି૚ ࢛࢔࢏ି૚ ሻ + ࣂ(∆࢞)૛


∆࢚
࢏ (15)
૛∆࢞
Equation 15 is used to advance the density field.

ࣆ ࣔ૛ ࢛
+ ࢛
࢛ࣔ ࢛ࣔ
= (16)
࢚ࣔ ࣔ࢞ ࣋ ࣔ࢞૛

Equation 16 is the Burger’s equation. A velocity grid of n x 3 was generated and initialized. The equation
16 was discretized as given below.

ࣆ∆࢚ ࢛࢔ ࢔ ࢔
࢛࢔ା૚ ࢛࢔࢏ ቀ
࢏శ૚ ି૛࢛࢏ ା࢛࢏ష૚
ቁ − ࢛࢔࢏ ቀ ቁ ൫࢛࢔࢏ା૚ − ࢛࢔࢏_૚ ൯
∆࢚
࢏ = + (17)
࣋࢔
࢏ ∆࢞૛ ૛∆࢞

Equation 17 is used to advance the velocity field. This velocity is then used in equation 15 for the next
time step.

Shubham Srivastava 000959606 Page 3


Next the literature discusses all the three cases mentioned in Section 4 in detail. Later in Section 6 all the
three cases have also been compared in graphs and conclusions have been drawn.

5.1) The first case handles the scenario where there is no random error involved. The velocity and the
density fields are just advanced like normal CFD equations using equations 15 and 17. This is a
very simple case with no randomness and smooth solutions.

5.2) The second case takes into consideration the scenario where there is a random error associated
with every time step but this error is not resolved and is allowed to stay in the system. Again
equations 15 and 17 are used to advance the density and velocity fields like normal CFD
equations but they just have an additional error term ϵ.

࣋࢔ା૚ = ࣋࢔࢏ - ቀ ቁ ሺ࣋࢔࢏ା૚ ࢛࢔࢏ା૚ − ࣋࢔࢏ି૚ ࢛࢔࢏ି૚ ሻ + ࣂ(∆࢞)૛ + ࣕ


∆࢚
࢏ ૛∆࢞
5.3) The third case is where Kalman Filter algorithm is used. Here again there is an error ϵ in the
density that is calculated using equation 15 but here the Kalman filter is employed to remove
this error. This is the discrete Kalman Filter instead of the continuous one which means that the
filter is used only to remove the errors at each step and not to advance the model. The Kalman
filter model is used exactly as explained in Section 3. Here equation 15 serves as the model
equation.

࣋࢔ା૚ = ࣋࢔࢏ - ቀ ቁ ሺ࣋࢔࢏ା૚ ࢛࢔࢏ା૚ − ࣋࢔࢏ି૚ ࢛࢔࢏ି૚ ሻ + ࣂ(∆࢞)૛


∆࢚
࢏ ૛∆࢞
The discretization error serves as the model error which also gives us the model error covariance.
The equation for observations is-

࣋࢔ା૚
࢏ ഥ࢔ା૚
= ࣋ ࢏ +∈ (18)

Here ρ is the density that is given by the equation and ̅ is the actual density at that time step that
has to be estimated by the Kalman filter. ϵ is the error associated with the observations. For
incorporating ϵ random Gaussian errors had to be generated to be added to the equations. This
was done as follows.

Generating a matrix of random Gaussian errors

Generate K M-dimensional random vectors ηkm+1 from a Gaussian distribution with zero mean
and covariance ro. For this generate random vectors by first randomly drawing a M x K size
matrix A and taking the singular value decomposition of AAT = FΣFT. Thus there are unbiased
random vectors which are nothing but the column vectors of the matrix T = (ro)1/2FΣ-1/2FTA.

In the next section i.e. Section 6 the results have been shown, compared and then discussed.

Shubham Srivastava 000959606 Page 4


6) Results and Discussions

Fig. 1- This shows a comparison between the actual density, unclean density and the clean density. The
density field has been advanced for 80 time steps and the Kalman filter has 2 iterations.

Fig. 2- This shows a comparison between the actual density, unclean density and the clean density. The
density field has been advanced for 80 time steps and the Kalman filter has 50 iterations.

Shubham Srivastava 000959606 Page 5


Fig. 3- This shows a comparison between the actual density, unclean density and the clean density. The
density field has been advanced for 180 time steps and the Kalman filter has 200 iterations.

Fig. 4- This shows a comparison between the actual density, unclean density and the clean density. The
density field has been advanced for 180 time steps and the Kalman filter has 350 iterations.

Shubham Srivastava 000959606 Page 6


Fig. 5- This shows a comparison between the actual density, unclean density and the clean density. The
density field has been advanced for 180 time steps and the Kalman filter has 400 iterations.

Fig. 6- This shows the Kalman gain of the algorithm after 5 iterations

Shubham Srivastava 000959606 Page 7


Fig. 7- This shows the Kalman gain of the algorithm after 50 iterations

Fig. 8- This shows the Kalman gain of the algorithm after 200 iterations

As can be seen from figures 1 to 5 the unclean density (red line) is just a random field and deviates to a
great extent from the actual density (blue line). The errors in the unclean density seem to having a
compounding effects and steadily take it away from the actual solution. They keep on accumulating in the
subsequent time steps if they are not cleaned.

On the other hand application of Kalman filter produces a marked effect on the unclean density field. It
produces a clean density (green line) which approximates the actual density field much more closely as
compared to the unclean density.

Shubham Srivastava 000959606 Page 8


Another worthy observation is the effect that number of iterations of the Kalman filter have on the
solution. In figure 1 the Kalman filter has been employed just twice. It does produce some positive result
as can be seen from the green line but still the approximation is not very close to the actual density field
and it is also not very smooth. As the number of iterations increase the clean density field gets closer to
the actual density field as can be seen from figures 2, 3, 4 and 5. There is a huge difference between 2 and
50 iterations. 200 iterations goes even more close but the difference is not as great as between 2 and 50.
Beyond 200 there is only very slight difference between the results. This shows that 200 iterations is
almost sufficient for the Kalman filter in this case. Although iterations more than that may produce better
results on some occasions.

Figures 6,7 and 8 show the Kalman gain for different iterations. In figure 6 the graph has still not
stabilized and has a slope. This shows that the Kalman filter has still not reached its optimum
performance after 5 iterations and there is scope for more improvement. In figure 7after 50 iterations the
graph has almost reached a stable value and there is only marginal difference between 50 and 200
iterations which also supports the observations made for graphs 2 and 3.

7) Conclusion
In this study a complete algorithm of Kalman filter for Burger and Continuity equation has been
developed. The results clearly depict the effect of Kalman filter technique on this problem. It has been
shown that Kalman filter has been efficiently implemented to obtain a clean density field which is in
agreement with the actual density field. Also the effect of iterations of Kalman filter has been shown
which proves that the Kalman filter gets more accurate with more number of iterations but attains
saturation after a certain number of cycles.

Shubham Srivastava 000959606 Page 9

También podría gustarte