AndreWeiner / wall_modeling

Development of OpenFOAM wall functions for turbulent flows
GNU General Public License v3.0
9 stars 7 forks source link

Deriving an integral fitting method #8

Closed AndreWeiner closed 3 years ago

AndreWeiner commented 3 years ago

Hi Jihoo, let's use this issue to derive the integral fitting step by step; I'll update this post after each completed step. The basic idea is as follows:

Say u_p is the cell-centered velocity. We want to find the friction velocity u_tau based on Spalding's formula such that the average velocity computed using Spalding's equations equals u_p. u_tau needs to be found iteratively.

Let's start as follows:

Best, Andre

JihooKang-KOR commented 3 years ago

Dear Andre,

In the recent commit, I implemented a function that finds 'u_tau' in the notebook. However, I found that the function yields the 'u_tau' that is the same with the initial 'u_tau'. (In OpenFOAM code, it will be sqrt((nutw[facei] + nuw[facei])*magGradU[facei]).)

In C++ file, y[facei] will be replaced with y_p_int[facei] calculated by Spalding's Function with the input of 'u_p_int', and magUp[facei] will be replaced with u_p_int[facei], where 'u_p_int' is the integral based cell center velocity and 'y_p_int' is the integral based cell center height.

I expected that the function gives the different value from the initial one, but the result is the same with the initial value. Therefore, I am not sure which role this function has (even the original 'calcUTau' function in OpenFOAM as well). I can think that the function has two possible features as follows:

  1. It yields the calculated and different 'u_tau' value from the initial one, but there were some mistakes in implementing the function.
  2. It yields the same value with the initial 'u_tau', but the purpose of the function is to make the value more robust.

Currently, I am getting stuck of my thinking process, and therefore I need more time to figure out why it happens. However, I would like to report the situation in the issue.

Thank you for reading this comment.

Best regards, Jihoo Kang

AndreWeiner commented 3 years ago

Dear Jihoo,

usual wall functions work as follows:

  1. you sample the cell-centered velocity value, the cell-center's distance to the wall, and the normal derivative of the velocity (computed with the standard discretization)
  2. with the normal derivate, an initial estimate of u_tau is computed; when plugging in all the values sampled in 1. and the initial u_tau value into Spalding's function, the left and right side of the equation won't match unless we are in the linear regime (very close to the wall)
  3. now we use the condition we get from Spalding's law and adjust u_tau iteratively until the equation is fulfilled (velocity and distance remain constant)
  4. then we use the new u_tau to correct the normal derivative by modifying the turbulent viscosity

What changes in our approach:

  1. instead of evaluating Spalding's function with the velocity at a given distance from the wall, we evaluate the average velocity in the cell; to compute the average, we integrate Spalding's function over the cell width and divide by the width; the average velocity, the normal derivative to compute the initial u_tau, and the cell width we sample from the simulation; in particular, we interpreted the cell-centered velocity value as average
  2. unless we are in the linear regime, the average we get with an initial u_tau from Spalding won't match the cell-centered value from the simulation; we use this condition to find u_tau iteratively
  3. now we use u_tau as in the old approach to correct the turbulent viscosity.

Best, Andre

JihooKang-KOR commented 3 years ago

Dear Andre,

In the last meeting, I was informed that the test of the integral method (the function 'function_intCombined') should be done as follows:

  1. Choose arbitrary 'u_sim' and 'u_tau_true' that are assumed to be the simulation and the real data.
  2. Compute y from them via Spalding's Function.
  3. Choose a random 'u_tau_initial'.
  4. Find 'u_tau_iter', which is the function of (u_sim, y, u_tau_initial), iteratively via the integral method.
  5. Compare 'u_tau_true' with 'u_tau_iter' by assert(abs(u_tau_true - u_tau_iter) < eps)

However, after I tested it, I had a feeling that the test cannot properly be carried out. Step 2 computes y via Spalding's Function, and therefore only the numerical methods that explicitly use Spalding's Function to find the velocity 'u_tau' can yield the same value. In case of the integral method, we need to let 'u_p_int' be the same with 'u_sim' by Secant Method, then find 'u_tau'. When we calculate 'u_p_int' by the numerical integration, we can observe that 'u_p_int' is smaller than the velocity from the simulation 'u_sim'.

For example, for given 'u_sim' and 'u_tau_true' with the identical condition for the other variables,

u_sim = 20
Given u_tau_true = 3

u_p_int = 17.864131474496343
With the number of iteration = 6, Calculated u_tau = 3.2207815264282478

Thus, when the equation u_p_int = u_sim holds, 'u_tau_iter' will intrinsically be greater than 'u_tau_true'.

I came up with a test method that uses the function 'integralNewton' which finds 'u_p_int' to compare with both 'u_p_int' values. But this method is also not valid because the integral method exists for the condition of the equation u_p_int = u_sim, and hence the initial 'u_p_int' cannot be the same with 'u_p_int' (= u_sim) in the method.

I hope to find any test method for the integral method, but I couldn't come up with any idea. In addition, I'm not sure if I understood the situation correctly. Therefore, I would like to report it in this issue.

Thank you for reading this comment.

Best regards, Jihoo Kang

AndreWeiner commented 3 years ago

Dear Jihoo, it's not a direct answer to your question, but I have started to revise the notebook. Please, have a look at the changes and try to revise the rest of the notebook. Maybe clearing up code and documentation also clears up the ideas ;-) Best, Andre