# Research on Multi-Physical Field Coupling Simulation of Local Electrochemical Machining
## 2 Materials and Methods
### Mathematical Model
#### 2.2.2 Two-Phase Flow Field  
Level set is a numerical technique used for interface tracking and shape modeling. It is mainly used to describe the dynamic changes of the two-phase flow interface, and to determine the fluid interface by tracing the contour lines of the level set function. The equation controlling the transfer and reinitialization of the level set variable \(\phi\) (bubble rate) is:  
\[\frac{\partial\phi}{\partial t}+v\cdot\
abla\phi=\gamma\
abla\cdot\left( \varepsilon\
abla\phi-\phi(1-\phi)\frac{\
abla\phi}{|\
abla\phi|}\right) \tag{6}\]  
where \(\gamma\) is the reinitialization parameter, usually the maximum velocity of fluid flow in the model. \(\varepsilon\) is the interface thickness control parameter. In order to ensure high stability in the calculation of the level set equation, \(\varepsilon=\mathrm{hc}/2\) is usually adopted, where \(\mathrm{hc}\) is the mesh size of the interface region.  
The global density \(\rho\) and dynamic viscosity \(\mu\) are:  
\[\rho=\rho_{1}+(\rho_{2}-\rho_{1})\phi \tag{7}\]  
\[\mu=\mu_{1}+(\mu_{2}-\mu_{1})\phi \tag{8}\]  
where \(\rho_{1}\) and \(\mu_{1}\) are the constant density and viscosity of the electrolytic liquid phase, respectively, \(\rho_{2}\) and \(\mu_{2}\) are the constant density and viscosity of air, respectively.  
To simplify the simulation process, the two-phase fluid is assumed to be a continuous incompressible Newtonian fluid, and the mass and momentum conservation equations are as follows [22]:  
\[\rho\frac{\partial v_{i}}{\partial x_{i}}=0 \tag{9}\]  
\[\rho\frac{\partial v_{i}}{\partial t}+\rho\frac{\partial\left(v_{i}v_{j} \right)}{\partial x_{j}}=-\frac{\partial p}{\partial x_{i}}+\frac{\tau_{ij}} {\partial x_{i}}+F_{i} \tag{10}\]where \(v_{i}\) is the \(i\)th component of the electrolyte velocity vector, \(x_{i}\) is the \(i\)th spatial coordinate, \(p\) is the pressure of electrolyte, \(\tau_{ij}\) is the \(i\)th element of the stress tensor, \(F_{i}\) is the \(i\)th component of the volume force.  
Due to the high velocity and complex flow field distribution in local electrochemical machining, the realizable \(k\)-\(\varepsilon\) turbulence model is adopted for simulation. The turbulence kinetic energy equation and dissipation rate equation are as follows:  
\[\rho\frac{\partial k}{\partial t}+\rho v\frac{\partial k}{\partial x_{i}}= \frac{\partial}{\partial x_{j}}\Bigg{[}\left(\mu+\frac{\mu_{T}}{\sigma_{k}} \right)\frac{\partial k}{\partial x_{j}}\Bigg{]}+G_{k}-\rho\varepsilon \tag{11}\]  
\[\rho\frac{\partial\varepsilon}{\partial t}+\rho v\frac{\partial\varepsilon}{ \partial x_{i}}=\frac{\partial}{\partial x_{j}}\Bigg{[}\left(\mu+\frac{\mu_{ T}}{\sigma_{\varepsilon}}\right)\frac{\partial\varepsilon}{\partial x_{j}} \Bigg{]}+\rho C_{1}E\varepsilon-\rho C_{2}\frac{\varepsilon^{2}}{k+\sqrt{ \
u\varepsilon}} \tag{12}\]  
where \(k\) is the turbulence kinetic energy, \(\varepsilon\) is the dissipation rate, \(G_{k}\) is the turbulent kinetic energy generated by the average velocity gradient, \(\mu_{T}\) is the coefficient of turbulence viscosity, the value of the constants are \(\sigma_{k}=1.0\), \(\sigma_{\varepsilon}=1.2\), \(C_{2}=1.9\), \(C_{1}=\max\Big{\{}0.43\), \(\frac{\eta}{\eta+5}\Big{\}}\), \(\eta=Ek/\varepsilon\), \(E=\left(2E_{ij}\right)^{1/2}\), and \(E_{ij}=\frac{1}{2}\Big{(}\frac{\partial v_{i}}{\partial x_{j}}+\frac{ \partial v_{j}}{\partial x_{i}}\Big{)}\).