1 Introduction

Molecular dynamics (MD) simulations have been widely used in the studies of fluid flow through a nanochannel/nanotube of finite length. To drive fluid molecules to move along a certain direction, many approaches have been proposed so far. There are mainly three kinds of methods, namely, the external driving force (EDF) method (Barrat and Bocquet 1999; Bitrián and Principe 2018; Ge et al. 2015; Nagayama and Cheng 2004; Priezjev 2007), the dual-control-volume grand-canonical molecular dynamics (DCV-GCMD)  method (Arya et al. 2001; Heffelfinger and van Swol 1994; Zheng et al. 2005) and the self-adjusting plate (SAP) method (Huang et al. 2006).

In the EDF method, an external driving force is applied on all fluid molecules (Barrat and Bocquet 1999; Priezjev 2007) or a small portion of them (Bitrián and Principe 2018; Ge et al. 2015; Nagayama and Cheng 2004). In the former case, periodic boundary condition is often used in the streamwise direction implying that the flow is homogeneous and fully developed in this direction; in the latter case, driving force is applied in the region near the inlet of the channel (Ge et al. 2015; Nagayama and Cheng 2004) or at both ends of reservoirs (Bitrián and Principe 2018). Fluid flow characteristics in the remaining part of the channel can then freely develop. The EDF method is easy to implement and widely used to study the interfacial properties, e.g., the effect of wettability and roughness of channel wall on slip length (Barrat and Bocquet 1999; Nagayama and Cheng 2004) and thermal resistance (Ge et al. 2015), as well as adopted in hybrid simulations to generate a pressure-driven like flow (Borg et al. 2013, 2015; Sun et al. 2010, 2012; Zhou et al. 2014). The main drawback of the EDF method is that although pressure gradient can be generated by applying force on a selected group of fluid molecules, the absolute pressures in two reservoirs are not given a priori and their magnitudes change when applying different forces. If not used appropriately, a large force can cause phase change at the exit of the channel because the absolute pressure at the exit is too low (Bitrián and Principe 2018).

In the DCV-GCMD  method, concentration or chemical potential gradients are generated by inserting or deleting molecules in two reservoirs. The main drawback of this method is that the dynamic field can be significantly disturbed with molecule insertion and deletion, especially for a dense system (Huang et al. 2008).

The SAP method was proposed by Huang et al. (2006). In this method, external forces are applied on two self-adjusting plates located at the ends of reservoirs to generate constant pressure fields. No molecule insertions or deletions are needed because the number of molecules is fixed. This method was used to study the flow of liquid argon in cylindrical nanopores (Huang et al. 2008) and water transport in carbon nanotubes (Wang et al. 2013) and hydrophilic nanochannels (Richard et al. 2016). To eliminate the disadvantage that the fluid is not able to circulate continuously due to the non-periodic boundary condition in the streamwise direction, Huang et al. developed a new method which integrates the advantages of the EDF method and the SAP method (Huang et al. 2011). In this method, a NT(P1P2) system can be produced, in which the absolute pressures in two reservoirs are predefined, making it superior to the methods which only produce an NTΔP system. However, the success of implementing the method, as stated in (Huang et al. 2011), requires that the ratio of the cross-sectional area of the nanopore to that of the reservoirs being smaller than 14%. Moreover, this method is suitable for short nanopores and nanochannels. For long nanochannels/nanotubes, a method enabling the absolute pressures to be dynamically controlled is needed. In this paper, a new method called the pump-piston method is proposed, which combines the merits of the EDF method and the SAP method. This method generates pressure difference by exerting an external force in a pump region, and controls the pressure in the back reservoir dynamically by adjusting the piston position. Using the new method, the ratio limitation of the cross-sectional area of nanochannel/nanotube to that of the reservoirs can be removed. In addition, the method is suitable for cases where extraction of macroscopic information requiring long-time simulations and large amounts of discrete data is needed, because the fluid is allowed to flow continuously and infinitely through the nanochannel/nanotube.

2 Description of the present method

The configuration of system in the present method is similar to that of Huang et al. (2011), except that at the exit of the channel, a piston is used. As shown in Fig. 1, two reservoirs are located at the ends of the channel. An external force is uniformly exerted on every atom in the very beginning part (pump region) of the front reservoir, whose magnitude is decided according to the pressure difference between the front and back reservoir. Different from the method proposed by Huang et al. (2011), at the end of the main channel, part of the plate is no longer fixed, but can move freely in the horizontal direction, acting like a piston. It can be regarded as an extension of the back reservoir. To keep fluid atoms stay in the reservoir, two walls formed by one layer of solid atoms need to be added. Therefore, the piston and these two walls construct another channel, which is called the piston channel. To maintain the outlet pressure to be the desired value, a force is added on the piston in x + direction. In general, this method consists of three stages:

Fig. 1
figure 1

System configuration and atom deletion and insertion regions

  1. 1.

    Equilibrium stage During this stage, the position of piston is fixed and the atoms in the entire system move freely until a thermodynamic equilibrium state is reached.

  2. 2.

    Atom deletion and insertion (ADI) stage During this stage, a uniform force is applied on every fluid atom in the pump region to generate the pressure difference between inlet and outlet of the channel; another uniform force is applied on part of piston atoms to adjust the pressure in the back reservoir; meanwhile, fluid atoms are deleted or inserted near the piston to keep the position of piston within a certain range.

  3. 3.

    Piston position self-adaption (PPSA) stage In this stage, no fluid atoms are deleted or inserted, and the position of piston is only decided by the external force and the interaction between piston atoms and fluid atoms. Meanwhile, a uniform force is always applied on fluid atoms in the pump region, as in the second stage.

After the system reaches thermodynamic equilibrium state, a pressure gradient is generated by applying a force in x direction within the region at the very beginning of the front reservoir, which is called pump region. The magnitude of the external force in the pump region is decided by

$$f_{x} = \frac{{\left( {P_{1} - P_{2} } \right)A}}{{N_{\text{pump}} }},$$
(1)

where P1 and P2 are inlet and outlet pressure, respectively, A is the cross-sectional area of pump region and Npump is the number of argon atoms in the pump region, which is updated at every time step.

To control the pressure in the back reservoir to be the desired value P2, an external force needs to be applied on the piston, which is called fpiston. As can be seen intuitively, the fluid pressure in the piston channel (marked as Ppiston) is directly related to fpiston, which will be validated in Sect. 4. In the ADI stage, we focus on controlling Ppiston to be the desired value P2. Once Ppiston has been controlled, the pressure in the back reservoir (marked as Pback) is controlled.

The interaction between wall and fluid, as found in Nagayama and Cheng (2004), has a significant effect on the pressure in the near-wall region, so the pressure in the piston channel will be influenced by the piston channel wall, and the pressure near the piston channel wall will be different from that in the bulk region of piston channel. Therefore, if fpiston is applied on all piston atoms, it will be difficult to control Ppiston. Alternatively, if fpiston is only applied on part of piston atoms which are far from the piston wall (marked by blue in Fig. 1a), Ppiston can be controlled precisely. Meanwhile, to keep the piston intact, the remaining piston atoms (marked by gold in Fig. 1a) should move with those being controlled by exerting fpiston. Consequently, the magnitude of fpiston is given by

$$f_{\text{piston}} = \frac{{P_{2} A^{\prime}_{\text{piston}} }}{{N^{\prime}_{\text{piston}} }},$$
(2)

where \(A^{\prime}_{\text{piston}}\) and \(N^{\prime}_{\text{piston}}\) are the cross-sectional area and the number of atoms of the constrained part of piston, respectively.

As the acceleration of piston is decided by both fpiston and the atomic interaction force from the fluid, the piston will move horizontally within a relatively large range during the ADI stage, due to that the pressure and density of fluid need to be adjusted automatically before the system reaches a quasi-steady state. If the piston moves beyond either end of the main channel, the simulation results will be unrealistic. To prevent this from happening, we restrict the position of piston within a small range in this stage by inserting or deleting atoms near the piston in the piston channel. As shown in Fig. 1b and c, the original position of piston is \(x_{0}\), while \(x_{1}\) and \(x_{2}\) are the left and right boundaries, respectively. For the sake of simplification, only the upper half of piston channel is shown. Every 500 time steps, the position of piston (marked as \(x_{\text{piston}}\)) is checked:

  1. 1.

    If \(x_{\text{piston}} < x_{1}\), as shown in Fig. 1b, fluid atoms which are located within the range between \(x_{\text{piston}}\) and \(x^{\prime}_{0}\) (\(x^{\prime}_{0}\) is 0.25 nm to the right of \(x_{0}\)) are deleted, then the piston is placed back to its original position \(x_{0}\). The purpose of deleting atoms between \(x^{\prime}_{0}\) and \(x_{0}\) is to prevent large interaction force between the piston and fluid atoms after placing the piston back to \(x_{0}\);

  2. 2.

    If \(x_{\text{piston}} > x_{2}\), as shown in Fig. 1c, fluid atoms need to be inserted into the system. The number of atoms to be inserted is calculated by \(N_{\text{insert}} = \rho_{n} A_{\text{piston}} (x_{\text{piston}} - x_{0} )\), where \(\rho_{n}\) is the number density of fluid in piston channel which is measured in a certain region away from the piston, and \(A_{\text{piston}}\) is the cross-sectional area of piston channel. Again, to prevent large interaction force between the piston and fluid atoms, newly inserted atoms should not be too close to the piston and, thus, the right boundary of atom insertion region is set to be \(x = x_{4}\) (\(x_{4}\) is 0.25 nm to the left of \(x_{\text{piston}}\)). Note that \(x_{4}\) is not fixed, but decided according to the position of the piston whenever atom insertion is needed. To make the insertion of atoms easier, the left boundary of atom insertion region is set to be \(x = x_{3}\), where \(x_{3}\) is 0.25 nm to the right of \(x_{\text{m}}\) which is the middle point of \(x_{1}\) and \(x_{0}\). Fluid atoms are then inserted in the region bounded by \(x = x_{3}\) and \(x = x_{4}\). During the atom insertion process, the piston is fixed, and two fictitious reflective walls are placed at \(x = x_{3}\) and \(x = x_{4}\) to prevent inserted atoms from running away from the system. Atoms will be bounced back after colliding with these two walls, with their tangential velocities unchanged and normal velocities reversed. One atom is inserted at each time step. After the insertion process is finished, the piston is moved to its new position \(x = x_{\text{m}}\); meanwhile, two fictitious walls are removed.

3 Computational details

The simulation system consists of three parts: the main channel, the reservoirs (including the front reservoir and the back reservoir) and the piston channel, as shown in Fig. 1a. The solid substrates constituting boundaries of the system include the front plates, the back plates, walls of the main channel, walls of the piston channel and the piston. The main difference between the present model and Huang et al.’s model (Huang et al. 2011) lies in that in the present model part of back plates is movable and functions as a piston.

All the solid substrates are composed of atoms of a face-centered cubic (FCC) lattice with a number density of 98.36/nm3. To save the computational time, all the substrates consist of only one layer of atoms, except that the walls of main channel consist of two layers of atoms. The fluid is argon. All the interactions between atoms are calculated by the shifted Lennard-Jones (LJ) potential as follows:

$$\phi \left( {r_{ij} } \right) = 4\varepsilon_{ij} \left[ {\left( {\frac{{\sigma_{ij} }}{{r_{ij} }}} \right)^{12} - \left( {\frac{{\sigma_{ij} }}{{r_{ij} }}} \right)^{6} - \left( {\frac{{\sigma_{ij} }}{{r_{\text{c}} }}} \right)^{12} + \left( {\frac{{\sigma_{ij} }}{{r_{\text{c}} }}} \right)^{6} } \right],$$
(3)

where \(r_{ij}\) is the distance between atoms i and j, \(\varepsilon_{ij}\) and \(\sigma_{ij}\) are the characteristic energy and length scales, respectively, and \(r_{\text{c}}\) is the cutoff distance, which is 0.85 nm in our simulations. The LJ potential parameters are summarized in Table 1. To reduce the effect of piston channel wall on the pressure of fluid in the piston channel, the characteristic energy scale \(\varepsilon_{{{\text{f}} - {\text{pw}}}}\) is set to be about \(0.3\varepsilon_{{{\text{f}} - {\text{f}}}}\). The characteristic energy scale for the interaction between fluid and other types of solid atoms is set to be the same as \(\varepsilon_{{{\text{f}} - {\text{f}}}}\). As explained in Sect. 2, the effect of piston channel wall on the fluid pressure is further reduced by exerting the external force on part of piston atoms. The time step is 5 fs, and the equilibrium stage lasts for 0.5 ns, whereas the ADI stage lasts for 1.5 ns. All the MD simulations are carried out in an open-source code LAMMPS (Plimpton 1995).

Table 1 Lennard-Jones potential parameters used in the present paper

The size of both reservoirs is 20 nm in the x direction and 20.12 nm in the y direction. The coordinate origin is set to be the same as the center of inlet boundary of the main channel. The length, width and depth of the main channel are L= 40 nm, Ly = 6.19 nm and Lz = 3.78 nm, respectively. To guarantee that there is no interaction between fluid atoms in the piston channel and that in the main channel, the piston channel wall is placed to be 1.2 nm away from the main channel wall in the y direction, which makes the vertical positions of two piston channel walls be ypw,1 = 4.47 nm and ypw,2 = − 4.47 nm, respectively. Both pistons are divided into two parts: one part on which external forces are applied (called piston I, and marked in blue, as shown in Fig. 1a), and the other part on which no external forces are applied (called piston II, and marked in gold, as shown in Fig. 1a). At every time step, once the position of piston I is updated, piston II is moved to the same position as piston I. Initially, the piston is located at \(x = 20.1\) nm, whereas during the ADI stage it is allowed to move between \(x = 18.1\) and \(x = 22.1\) nm, namely, \(x_{1}\) and \(x_{2}\) in Fig. 1b and c are 18.1 nm and 22.1 nm, respectively.

The initial density of fluid is set to be the value corresponding to the average pressure of the predefined inlet pressure and outlet pressure, which is taken directly from NIST database (NIST 2005). Note that an appropriate initial value of fluid density can reduce the times of inserting or deleting fluid atoms. During the simulation, except the piston, all the solid atoms are fixed at their original positions, i.e., there is no heat conduction between solid and fluid atoms. The dissipative particle dynamics (DPD) thermostat is used to control the fluid temperature to be Tf = 132 K. Due to its profile-unbiased property, the DPD thermostat is suitable for non-equilibrium MD simulations (Bitrián and Principe 2018; Yong and Zhang 2013). Different from the thermostats involving individual atom velocities [e.g., Langevin thermostat (Thompson and Troian 1997)], the DPD thermostat is related to the relative velocities \(u_{ij} = u_{i} - u_{j}\) between atom pairs. By adding two extra terms, the equations of motion are

$$m_{i} \frac{{{\text{d}}u_{i} }}{{{\text{d}}t}} = - \sum\limits_{j \ne i} {\nabla_{{r_{i} }} \phi \left( {r_{ij} } \right)} + F_{i}^{\text{D}} + F_{i}^{\text{R}} ,$$
(4)

where \(F_{i}^{\text{D}}\) and \(F_{i}^{\text{R}}\) represent the dissipative force and the random force, respectively. The expressions of these two forces are

$$F_{i}^{\text{D}} = \sum\limits_{j \ne i} {F_{ij}^{\text{D}} } = - \sum\limits_{j \ne i} {\gamma \omega^{2} \left( {r_{ij} } \right)\;\left( {\hat{r}_{ij} \cdot u_{ij} } \right)} \;\hat{r}_{ij} ,$$
(5)

and

$$F_{i}^{\text{R}} = \sum\limits_{j \ne i} {F_{ij}^{\text{R}} } = \sum\limits_{j \ne i} {\sqrt {2k_{\text{B}} T_{\text{f}} \gamma } \omega \left( {r_{ij} } \right)\theta_{ij} } \hat{r}_{ij} ,$$
(6)

where \(\hat{r}_{ij} = {{(r_{i} - r_{j} )} \mathord{\left/ {\vphantom {{(r_{i} - r_{j} )} {\left| {r_{ij} } \right|}}} \right. \kern-0pt} {\left| {r_{ij} } \right|}}\), \(\gamma\) is the friction coefficient (\(\gamma = \;3.1 \times 10^{ - 14}\) kg/s in our simulations), \(\theta_{ij}\) is the Gaussian white noise, and the weighting function \(\omega \left( {r_{ij} } \right)\) is chosen as

$$\omega \left( {r_{ij} } \right)\; = \;\left\{ {\begin{array}{*{20}l} {1 - {r \mathord{\left/ {\vphantom {r {r_{c} ,}}} \right. \kern-0pt} {r_{c} ,}}} \hfill & {r_{ij} < r_{c} } \hfill \\ {0,} \hfill & {r_{ij} \ge r_{c} } \hfill \\ \end{array} } \right..$$
(7)

The distribution of stress tensor \(\varvec{\sigma}_{\alpha \beta }\) along the center line of main channel is calculated by Irving–Kirkwood equation (Irving and Kirkwood 1950) using bins of size \(\Delta x = 0.5\) nm and \(\Delta y = 1.5\) nm, and the constitutive pressure is computed as the trace of the stress tensor (Huang et al. 2011) as follows:

$$P = - Tr\left( {\sigma_{\alpha \beta } } \right)/3.$$
(8)

4 Results and discussion

In this work, in order to validate the present method, we simulate fluid flow of argon/water through two kinds of nanochannels: parallel-plate nanochannel and nanotube. The configuration of parallel-plate nanochannel had been introduced in Sect. 2, whereas the setting of nanotube will be given in Sects. 4.2 and 4.3.

4.1 Simulations of argon flowing through a parallel-plate nanochannel

To test the present method in different cases with different inlet pressure P1 and outlet pressure P2, three cases are studied:

Case 1:

\(P_{1} = 70\;{\text{MPa}}\), \(P_{2} = 40\;{\text{MPa}}\).

Case 2:

\(P_{1} = 80\;{\text{MPa}}\), \(P_{2} = 30\;{\text{MPa}}\).

Case 3:

\(P_{1} = 90\;{\text{MPa}}\), \(P_{2} = 20\;{\text{MPa}}\).

During the simulation, the change of piston position with time for case 1 is shown in Fig. 2. It can be seen that during the ADI stage (\(500\;{\text{ps < }}t < 2000\;{\text{ps}}\)) the fluctuation amplitude of the piston’s position is the largest, which indicates the force imbalance between the external force and the interaction force from the liquid, thus necessitating atom deletions or insertions. Meanwhile, the piston’s position is almost always within the range from \(x = 18.1\) to \(x = 22.1\) nm, which means that the present method works well during this stage. It can be seen from the inset of Fig. 2 that six downward peaks and two upward peaks can be found, which means that atom deletion has been implemented six times and atom insertion twice. During the PPSA stage (\(t \ge 2000\;{\text{ps}}\)), the piston moves within a small range of about 1 nm near its original position. It should be noted that during this stage no atom deletion or insertion is implemented, meaning that the simulation system gradually comes to a quasi-steady state.

Fig. 2
figure 2

The change of piston position with simulation time

The pressure distribution along the streamwise direction is shown in Fig. 3. The red dashed lines represent the target pressures. It can be seen that the pressures in both the front reservoir and the back reservoir agree well with the target pressures. The pressure drops at the entrance are larger than that at the exit of the channel. Both of them increase with the increase of pressure difference between the front and back reservoirs. The pressures averaged in the front (averaged from \(x = - \;15\) to \(x = - 10\;{\text{nm}}\)) and back reservoir (averaged from \(x = 50\) to \(x = 60\;{\text{nm}}\)) for three cases are shown in Table 2. The largest deviation from the calculated pressure to the target pressure is 3.15%, which is found in the back reservoir of case 3.

Fig. 3
figure 3

Pressure distribution along the streamwise direction

Table 2 Pressures in the front and back reservoirs

The pressure distribution along the piston channel is shown in Fig. 4. We can see that the pressures in the piston channel agree very well with the given pressures in the back reservoir, which is exactly the essence of the present method, i.e., by controlling the pressure in the piston channel, we can control the pressure in the back reservoir.

Fig. 4
figure 4

Pressure distribution in the piston channels

To test the present method in the case of varying pressure difference with time, we took the steady state of case 2 as the initial condition and set the initial time as t0 = 0. Then, the external force \(f_{t}\) in the pump region is linearly increased from the initial value as follows:

$$f_{t} = f_{0} + \frac{{a_{\text{P}} tA}}{{N_{\text{pump}} }},$$
(9)

where \(f_{0}\) is the initial force, and \(a_{\text{P}} = 0.01\;\;{\text{MPa/ps}}\) is the increasing rate of pressure in the front reservoir. The variation of pressure distribution with simulation time is shown in Fig. 5. It can be seen that as \(f_{t}\) increases, the pressure in the front reservoir increases, while the pressure in the back reservoir keeps constant. The averaged pressures in the front reservoir (averaged from \(x = - \;15\) to \(x = - \;10\) nm) for t = 1250 ps and 3750 ps are 92.98 MPa and 118.21 MPa, respectively, which are very close to the expected values (92.5 MPa for t = 1250 ps and 117.5 MPa for t = 3750 ps). The results show that the present method is also suitable for simulating unsteady fluid flow problems.

Fig. 5
figure 5

Change of pressure distribution with time

4.2 Simulations of argon flowing through a nanotube

To further prove the generality of the present method, the fluid flow through a cylindrical nanotube with a radius of 2.0 nm and a length of 40 nm was simulated. As depicted in Fig. 6, similar to the setting of the rectangular channel, a piston which can move freely along the axial direction of nanotube is used. To be consistent with the nanotube, the shape of piston channel wall is cylindrical with a radius of 2.8 nm. Again, three cases with different inlet and outlet pressures have been simulated. As can be seen in Fig. 7, calculated pressures in the front and back reservoirs are almost the same as specified, which again verifies the present method. In the main channel, except the regions near the entrance and exit, the pressures are linearly distributed.

Fig. 6
figure 6

System configuration of nanotube

Fig. 7
figure 7

Pressure distribution along the streamwise direction

The number density and streaming velocity of argon along the radial direction at four different cross sections are shown in Fig. 8. The abscissa represents the distance from the center of nanotube in the radial direction. In Fig. 8a, six peaks can be found in the density profiles, which means that six circular layers were formed in the nanotube. The compressibility of the flow leads to the density variation along the streamwise direction, i.e., the density decreases with the increase of x, especially for the peak values. In Fig. 8b, it can be found that the velocity profiles are all quasi-parabolic with a slip at the solid–fluid interface. The velocity increases along the streamwise direction, due to the decrease of fluid density along this direction and that the mass flow rate is constant. It is also obvious that the slip grows with increasing shear rate, which is in accordance with that found by Thompson and Troian (1997).

Fig. 8
figure 8

Distribution of number density and streaming velocity of argon along the radial direction. The vertical dashed lines represent the internal surface of nanotube

In addition, it is necessary to investigate end effects on pressure drop. As can be seen in Fig. 7, pressure losses exist at the entrance and exit of the nanotube. When fluid flows from large reservoirs into (or out of) small channels, sharp curvature of streamlines causes the pressure losses near the ends of channel (Sisan and Lichter 2011; Suk and Aluru 2010; Weissberg 1962). The pressure loss due to end effects, ΔPe, is calculated as follows (Weissberg 1962):

$$\Delta P_{\text{e}} = \frac{\mu CQ}{{R^{3} }},$$
(10)

where μ is the dynamic viscosity of argon, C is the loss coefficient, Q is the volumetric flow rate, and R is the channel radius.

Besides case 1–case 3, two additional cases have been simulated, namely, case 4 and case 5. For case 4, the inlet pressure is 75 MPa and the outlet pressure is 35 MPa, making the pressure drop along the channel 40 MPa; for case 5, the inlet pressure is 85 MPa and the outlet pressure is 25 MPa, making the pressure drop along the channel 60 MPa. The loss coefficients at the entrance and exit as well as the total loss coefficient (the sum of the entrance and exit loss coefficients) are shown in Fig. 9. The abscissa represents the total pressure drop between the entrance and exit of the channel. It can be seen that at the entrance when the total pressure drop increases the loss coefficient gradually decreases and then converges to about 1.9, whereas at the exit with the increase of the total pressure drop the loss coefficient gradually increases and then converges to about 0.85. It is interesting to note that with the change of total pressure drop the change of total loss coefficient is small (between 2.75 and 2.95). For the total loss coefficient, the simulation results are close to that reported by Weissberg (1962) in which C = 3. According to the continuum model, the entrance loss coefficient should be the same as the exit loss coefficient (Sisavath et al. 2002). The large difference between the two coefficients in nanofluidic system may be due to the use of small size of reservoirs, the treatment of upstream/downstream boundaries or the use of thermostat at the molecular level (Sisan and Lichter 2011).

Fig. 9
figure 9

Variation of loss coefficient with total pressure drop

4.3 Simulations of water transport through a carbon nanotube

Water transport through the carbon nanotube (CNT) is of great interest to researchers who work in the domains such as water desalination and drug delivery. Depending on the diameter of CNT, the water structures inside the CNT are very different, such as single-file molecular chains, stacked pentagonal rings and disordered bulklike water (Thomas and McGaughey 2009). Meanwhile, the water viscosity and slip length are also functions of CNT diameters (Thomas and McGaughey 2008). The change of water structure and transport properties with decreasing CNT diameter results in the transition from continuum to subcontinuum transport (Thomas and McGaughey 2009). Therefore, it is important to test our present method on water transport in CNT.

Two chiralities of (8, 8) and (12, 12) for CNT are studied, whose radiuses are 0.546 nm and 0.813 nm, respectively. The length of CNT is 20 nm. The lateral extent of each reservoir is 8 × 8 nm2 and the length of each reservoir in the water flow direction is 3 nm. As shown in the cross-sectional view of simulation system in Fig. 10, in addition to the inner CNT, another CNT of larger radius is created to construct the piston channel wall. For (8, 8) CNT, the chirality of the outer CNT is (12, 12) with a radius of 0.813 nm; for (12, 12) CNT, the chirality of the outer CNT is (17, 17) with a radius of 1.152 nm. The piston and the plate are constructed by single-layer graphene. To prevent water in the CNT from interacting with water in the piston channel and carbon atoms of the piston channel wall by van der Waals and long-range Coulombic forces, we use the “neigh_modify exclude group” command in LAMMPS. In every time step, water in the CNT is marked as group I, while water in the piston channel and carbon atoms of the piston channel are marked as group II. Using this command, all the interactions between group I and II are mandatorily removed.

Fig. 10
figure 10

System configuration of water transport through (12, 12) CNT

The TIP4P/2005 model (Abascal and Vega 2005) is adopted for water molecules. SHAKE algorithm (Ryckaert et al. 1977) is used to constrain the geometry of water molecules. The interaction between oxygen atoms of water and carbon atoms of the CNT is described by LJ potential with \(\varepsilon_{{{\text{C}}{-}{\text{O}}}} = 0.392\;\;{\text{kJ/mol}}\) and \(\sigma_{{{\text{C}}{-}{\text{O}}}} = 0.319\) nm, whereas LJ potential coefficients between oxygen atoms of water and carbon atoms of other solid parts (including the piston, the plate and the piston channel wall) are \(\varepsilon_{{{\text{C}}_{\text{p}} {-}{\text{O}}}} = 0.5925\;\;{\text{kJ/mol}}\) and \(\sigma_{{{\text{C}}_{\text{p}} {-}{\text{O}}}} = 0.319\) nm (Walther et al. 2013). Cutoff radii for LJ and Coulomb interactions are both 1.0 nm. The particle–particle particle-mesh method (Deserno and Holm 1998) is adopted to handle the long-range Coulomb interaction. The time step is set to be 2 fs.

Four cases are simulated to test our method for different chiralities of CNT, different CNT wall properties (fixed or active) and different pressures in the back reservoir, as shown in Table 3. In case 1, case 2 and case 4, all carbon atoms are fixed. In case 3, except the CNT, all carbon atoms are fixed. Carbon atoms of the CNT wall are allowed to vibrate around their initial positions, thus enabling us to study the realistic heat transport between water and CNT. To prevent CNT from drifting away, carbon atoms within 0.5 nm from two ends of CNT are fixed. For the active CNT wall, the second-generation REBO potential (Brenner et al. 2002; Thomas et al. 2010) is used to model interactions between carbon atoms. To control the water temperature at 298 K, Berendsen thermostat (Berendsen et al. 1984) is applied to one of the velocity components transverse to the water flow direction. For case 3, the temperature of water in the CNT is not controlled. Instead, the temperature of the CNT is controlled to be 298 K using the Nose–Hoover thermostat (Nose 1984; Hoover 1985) on carbon atoms.

Table 3 Four cases for simulations of water transport through CNT

The pressure profile in the front and back reservoirs is shown in Fig. 11. Here, the pressure of water in regions either near the CNT wall or inside the CNT is not shown because it cannot be calculated precisely using the Irving–Kirkwood equation, due to the influence from carbon atoms within narrow spatial limits. The pressure in the front reservoir is controlled by applying force on water molecules within the pump region which is located between − 30 and − 20 Å in the x direction. Because the length of the reservoir regions (in the x direction) is short compared to cases of liquid argon flowing through nanochannel/nanotube, it can be seen in the front reservoir that the pressure immediately drops after reaching the prescribed value. In the back reservoir, pressures are well controlled. The average pressures in the back reservoir for case 1 to case 4 are 19.33 MPa, 19.31 MPa, 19.36 MPa and 4.81 MPa, respectively. Therefore, it can be concluded that our method works for water transport through both fixed and active CNT walls with outlet pressure as low as 5 MPa.

Fig. 11
figure 11

Pressure distribution in the reservoir regions

The water structures inside CNTs are shown in Fig. 12. A square ring of water molecules is observed in the (8, 8) CNT, which has been reported in previous literatures (Wang et al. 2012; Liu and Patey 2014). However, a stacked pentagonal ring of water molecules inside the same CNT was found by Thomas and McGaughey (2009). The difference may be due to that different models for water molecules were used. TIP4P/2005 model was used in the present paper whereas TIP5P model was used by Thomas and McGaughey (2009) in their simulations. It has been demonstrated that different models can result in very different water structures and properties in confined situations. For the (12, 12) CNT, because water structures inside CNTs with active wall are similar to the case of fixed wall, only the result for the fixed wall is shown. Inside the (12, 12) CNT, the water molecules nearly exhibit disordered bulk-like structure, except for the inner ring at the central part of CNT, similar to that found by Wang et al. (2012).

Fig. 12
figure 12

Water structures inside the (8, 8) and (12, 12) CNTs

5 Conclusions

A new method is proposed to control pressures in the front and back reservoirs for argon/water transport through nanochannel/nanotube. By adjusting the pressure in the piston channel, the pressure in the back reservoir is precisely controlled. The pressure in the front reservoir is generated by applying an external force on fluid atoms in the pump region. When the external force is linearly increased in the pump region, the method can guarantee that the pressure in the back reservoir keeps constant and meanwhile the pressure in the front reservoir increases as expected. The simulation results show that the method is suitable for both steady and unsteady fluid flow problems. Simulations of argon flowing through a long nanotube also verify the accuracy of the method, and the loss coefficients related to pressure losses due to end effects agree well with that reported in previous literatures. Finally, the method has also been found to work effectively for water transport through a carbon nanotube.