Introduction
Step by step procedure :
Step 1 : Data parsing. The first step involves importing the required information from the data files (.txt). In practice, we need to extract the numeric data from the first (Y) and second (U) columns for the regression problem. This can be done in three different ways : 1. Copy and paste the data into your python code (as shown in the previous code block) -this solution is not recommended for large datasets-. 2. Remove the header from each file, leaving only numeric data in it, then import the data as a NumPy array - this solution is ok for large datasets but it is always a bad idea to manually modify data files, because you could accidentally end up modifying the data-. 3. Write a function to parse each file (since they all share the same data format) automatically. This last solution requires some advanced programming.
Step 2 : Preprocessing. The data contained in the data files are written in terms of y and not r. by inspecting your data you can see that the velocity is max at y close to R=0.45 and almost zero where y is close to 0. Therefore we need to apply a transformation to the original formula to find u(y) by substituting y = R-r into the equation for u(r). With this new formula we should be able to fit (that is, find the best values) for n and Umax using the experimental data from one data set. However...
Step 3 : Data preprocessing. ...The linear regression techniques do not apply here, because the formula of the velocity is a power law !!! By applying a proper mathematical transformation to the data you can make this nonlinear function linear again.
Step 4 : Linear Regression. Once you figure this out, you should be able to apply linear regression to a "transformed problem" to learn the best values for n and U_max . Repeat this procedure for all datasets except the Retau35k dataset. We will use this dataset to perform a leave-one-out validation. Basically we assume that we are "blind" to some of the data, and we seek for n and U_max without using that data. After finding appropriate values for n and U_max we can use them to predict the velocity for the case Re=35K and verify that the predicted velocities agree with the experimental observations.
Step 5 : Validation. Use the regression values to interpolate n and Umax at Reynolds = 35061, and predict the velocity profile for values of y in the file of reynold's number 35k. Compare the velocity profile you just found with the experimental data in column U, and compute the error.
At Re = 5522, U_max = [5.345474892628102], n = [7.709621814144551]
At Re = 9906, U_max = [9.956642418546151], n = [8.175764807367832]
At Re = 21337, U_max = [23.47846866135902], n = [8.416752383882887]
At Re = 31793, U_max = [34.66867978262896], n = [9.394364613077625]
At Re = 39855, U_max = [44.01453368064284], n = [9.46679233039229]
Regression Data: At 35K, U_max = 38.57762176945227, n = 9.327454541263332
Experimental Data: At 35K, U_max = [[38.68463680117012]], n = [[9.171513171688852]]
RELATIVE ERROR = 0.2877638663130547 %