## 3 Model Establishment
### Model Building  
The rheological model is an important method for describing the rheology of drilling fluid. Rheological parameters in rheological model can be calculated based on readings from a six-speed rotational viscometer. Therefore, if the readings of the six-speed rotational viscometer of the drilling fluid under different temperature and pressure conditions can be obtained, then the rheological parameters under the corresponding conditions can be calculated to determine the rheological properties of the drilling fluid under different temperatures and pressures. It is impractical to experimentally obtain rheometer readings at all temperatures and pressures. Therefore, this paper establishes a predictive viscometer reading model to obtain rheometer readings at any specified temperature. After determining the shear stress values at a set of six rotational speeds, the rheological parameters of different rheological models can be determined via regression. The conversion relationship between the rotational speed and the reading of a six-speed viscometer in terms of shear rate and shear stress is as follows:  
\[\tau=0.511\theta \tag{1}\]  
\[\gamma=1.7032\text{N} \tag{2}\]  
where \(\tau\) is the shear stress (Pa), \(\gamma\) is the shear rate (1/s), \(\theta\) is the reading of a six-speed viscometer (lb/100 ft2), and N is the rotational speed (1/min). Figure 3: Variation in rheological curve with temperature in the Hu 6 well. Therefore, a prediction of a six-speed viscometer reading is a prediction of shear stress at a given shear rate. After obtaining the predicted six-speed viscometer readings under a certain temperatures and pressures, the rheological model can be selected and the corresponding rheological parameters can be determined. Since the variation in shear stress with temperature and pressure is different at different rotational speeds, corresponding prediction models need to be established. The accuracy of nonlinear regression is greatly affected by the regression function. However, different drilling fluids may conform to different regression functions. This paper uses a parameter-free method for regression to expand the application range of the model. Parameter-free models do not make any special assumptions regarding the regression function, which makes them more flexible in terms of reducing bias. Weighted linear regression, which introduces a weight function into the traditional linear regression model, was adopted in this paper. The mathematical expression for weighted linear regression is as follows:  
\[\mathrm{y}=\varphi\cdot\mathrm{x} \tag{3}\]  
The coefficient matrix \(\varphi\) of the prediction point can be calculated via the following formula:  
\[\varphi=\left(\mathrm{X}^{\mathrm{T}}\mathrm{W}\mathrm{X}\right)^{-1}\mathrm{ X}^{\mathrm{T}}\mathrm{W}\mathrm{Y} \tag{4}\]  
where Y is the measured data and W is the weight coefficient; the weight function in this article uses a Gaussian kernel function. The Gaussian kernel function is a matrix with non-zero diagonal data only, and the expression of the Gaussian kernel function is as follows:  
\[w_{i,i}=e^{(-\frac{\left\lVert\mathrm{x}-\mathrm{y}_{i,i}\right\rVert}{2^{ \varphi}})} \tag{5}\]  
where \(\sigma\) is the weight ratio, x is the temperature and pressure of the prediction point, and \(x_{i}\) is the temperature and pressure of the actual data point. After inputting the temperature and pressure conditions that need to be predicted, the corresponding weight coefficient and coefficient matrix can be calculated to obtain the prediction readings under this condition. After obtaining the readings of the six-speed viscometer under the predicted temperature and pressure conditions, the rheological model of the drilling fluid can be determined through the traditional rheological model optimization method and the corresponding rheological parameters can be calculated. For the problem studied in this article, the independent variables are the temperature and pressure values of the predicted point.