1 Introduction

Currently, microfluidic and micro-droplets have wide applications in various areas such as biomedical engineering, chemical engineering, and medicine (Lashkaripour et al. 2018; Jung and Oh 2014; Song et al. 2003). Micro-droplets provide a large advantage for not only the engineers but also for the pharmacists and therapists because of its high precision, accuracy, sensitivity and fast reaction time and its small size (Ray et al. 2017). Droplets have a confined space which can be used as an ideal reactor for biochemical and chemical processes (Nguyen et al. 2010). However, the field of microfluidics has not been deployed in the life sciences due to the costly and time-consuming process of manufacturing and the complex and nonlinear dynamics of the two phase flow (i.e. two immiscible fluids such as oil and water inside the microfluidic channel). Hence, presenting models which can investigate the role of different effective parameters on the droplet size is very attractive. These models can save time and money by avoiding experimental tests.

The first concept that exists here is the way of generating droplets. A large variety of methods with some advantages and drawbacks has been presented so far for this purpose (Park et al. 2011; Mastiani et al. 2019; Murshed et al. 2009). It can be said that electricity has had the most use in this field (Chong et al. 2016). Link et al. used a DC voltage in order to control the formation of droplet in a microfluidic setup. They used electrical field generated by some electrodes on bottom of the channels to provide an individual droplet controlling system/model (Link et al. 2006). Kim et al. described a flexible emulsification method which used an electric field to create droplets in a flow focusing micro-channels (Kim et al. 2007). Malloggi et al. demonstrated improved control and flexibility of the flow of two immiscible liquids on the basis of electro-wetting (EW) (Malloggi et al. 2008). As thermal methods, Nguyen et al. used a temperature sensor and an integrated micro-heater to control the process in which the droplets are formed. This method exploits whether interfacial tension and viscosities depend on temperature (Nguyen et al. 2007). Park et al. used a pulse laser-driven droplet generation (PLDG) mechanism, their PLDG device consisted of two micro-channels, water and oil, which were connected using a nozzle shaped opening. The actuation mechanism of PLDG was based on laser pulse induced rapidly expanding cavitation vapor bubbles (Park et al. 2011). The other methods are mechanical, creating perturbation (Willaime et al. 2006), chopping the flow (Chen and Lee 2006), manipulating the flow with membrane valves (Lin and Su 2008) and utilizing piezoelectric feature (Bransky et al. 2009). After the electrical methods, the most important category is the magneto-fluidics (Aboutalebi et al. 2018), because of its simple creation, being contactless and the fact that variables such as pH, temperature, surface charges and ionic concentrations does not have any impact on magnetic interactions, while they play a role in the electrical method (Pamme 2006). Nguyen et al. reported a way to magnetically manipulate ferrofluid droplets and the dynamic behavior of them. An array of planar coils was fabricated on a double-sided printed circuit board (PCB) to create the magnetic field (Nguyen et al. 2006). In his other work, he used a core with coils to generate magnetic field around the PDMS chip to have a uniform magnetic field. 350 turns of coil were spiraled round a ‘U’ shape core made of steel with a little air gap, and the strength of the magnetic field was changed using a DC power source.

Making the magnetic field stronger, increased the size of the droplet. The size of droplet increased with increasing magnetic field strength. The flow rates of both continuous and dispersed fluids determine how much the droplet size changes by altering the magnetic field (Liu et al. 2011). Tan et al. used a small permanent magnet to affect the flow for droplet generation. In their experiment, small circular magnet made of neodymium iron boron (NdFeB) with the diameter of 3-mm and thickness of 2-mm generated the external magnetic field. They located the magnet in various distances of 2.3 mm to 3.8 mm from the center of the microchannel to vary the impact of the magnetic force on the ferrofluid. The magnet was placed either downstream or upstream relative to the dispersed phase channel to change the direction of the attractive magnetic force (Tan et al. 2010). The important point in the different techniques on droplet generation is the process control. For this goal, a suitable detection method is needed. In magnetic cases, we can refer to GMR sensors (Rife et al. 2003), using spin-valves (Graham et al. 2005). In electrical cases, we can refer to resistive sensors (Cole and Kenis 2009) which have some limitations (Srivastava and Burns 2006), and capacitive sensors which are very useful and simply designed. In this case, we can detect the microscale droplet size and speed without contact (Elbuken et al. 2011). In addition to these methods, there is a common approach that is an optical technique. In this way, a high-speed camera is used and its outputs are processed in an image processing algorithm.

After a quick look at these methods, the first topic that seems necessary is preparing the precise equipment to study the effects of parameters. The syringe pumps are commonly used for controlling the flow rate of the two fluids, but due to the mechanical oscillations of the pump motor, the droplets size undergoes some periodic changes such as noises (Zeng et al. 2015). In addition to the pumps, method of image processing needs sensitive and expensive microscopes and high-speed cameras for size detection. In order to avoid these difficulties, designing a system to predict the droplet size is necessary.

Soft computing methods such as fuzzy based neural network prepare ways to present a precise mathematical model (Lashkaripour et al. 2018; Zadeh 1997). By using these methods, the qualitative facets of human knowledges are modeled without using quantitative calculation. However, there are no standard methods to transform knowledge into the rule-base of a fuzzy system (Jang 1993). There are many applications of these networks in the literature. For instance, the multi-layer perceptron (MLP) or radial basis function (RBF) are used as an observer for different systems (Pourrahim et al. 2016; Chen et al. 2016; Liu et al. 2008; Lin et al. 2014; Ruifu et al. 1997; Hua et al. 2014; Theocharis and Petridis 1994; Bayat et al. 2019). Also, Adaptive Neuro Fuzzy Inference system (ANFIS) is used as an observer (Bayat et al. 2019; Guzinski et al. 2011; Giribabu et al. 2015; Ismail 2011; Singh and Chandra 2010). With ANFIS, we can train a virtual system to predict the effects of different parameters. In ANFIS, two characteristics exist, i.e. the capability of learning from neural networks and the capability of deduction from fuzzy systems. A fuzzy system can group and cluster data to several categories. Moreover, it can use linguistic variables for describing complex systems. However, fuzzy systems, despite artificial neural networks (ANNs), are unable to learn (Goharimanesh et al. 2015). The ANNs are able to extract the nonlinear relations between outputs and inputs and create a mathematical model. However, the accuracy of the ANN will lose in dealing with systems which behaves differently depending on the states of the system (Lashkaripour et al. 2018). To avoid this limitation and using the clustering power of fuzzy systems and learning capabilities of ANN, ANFIS is used (Jang 1993). Because of nonlinear dynamics of the two phase flow in a micro-channel, ANFIS structure has better results than the standard linear regression method and ANN. In other words, ANFIS has a better coefficient of determination relative to linear regression method and ANN [38, 47–49]. ANFIS prediction has better result in comparison with the linear regression method due to its nonlinear dynamics.

In this paper, we created an accurate ANFIS model to study the effective parameters in microfluidics droplet generation and droplet diameter. Important non-dimensional parameters which describe the flow regime in a microfluidic device are a. Capillary number, b. Reynolds number, c. flow ratio and d. viscosity ratio which are considered as the inputs of the proposed ANFIS. The droplet size is considered as the output of the ANFIS. The analysis is done for the first time for the flow-focusing device. Working with non-dimensional groups has comprehensiveness instead of dimensional ones. It causes to extendable results instead of changing dimensional parameters such as width of the channel, viscosity of each fluid, flow rate of each fluid and etc., which can be generalized to other experiments.

In this multidisciplinary article, three difficult areas of scientific research meet: complex mathematical modeling of flows, advanced experimental work on drop generation and the use of ANFIS as a surrogate for computation or experiment.

At first, we obtain some input-output dataset from numerical simulations and experimental verifications. These required data sets for ANFIS training and testing are obtained by changing the non-dimensional numbers in some levels. Moreover, in this work, Taguchi method (Roy n.d.) is used to decrease the unnecessary experiments with the goal of decreasing the wasted costs and time.

The structure of the paper is as follows. In the next section, the process of droplet generation in a micro-channel is examined. The experimental setup and numerical simulation are explained in this section. At the end of this section the data set is extracted. The ANFIS model is built in section 3 using hybrid learning algorithm. Finally, the evaluation of model and conclusion are presented.

2 Microfluidic droplet generation

Microfluidic droplet generation can commonly occur in two configurations, T-junction and flow-focusing junction (Chong et al. 2016; Peng et al. 2011). In this work, we use the flow-focusing junction model which its geometry is shown in Fig. 1. In Fig. 1a, w1 is the width of the continuous phase channel and w2 is the width of the discrete phase channel. The length of the continuous phase channel is h and \( {h}_1=\frac{h}{2} \). The length of the discrete phase channel is L and \( {L}_1=\frac{L}{2} \). The flow rate of the continuous and discrete phases are Qc and Qd, respectively. The flow is assumed isothermal and incompressible. The gravity force is neglected.

Fig. 1
figure 1

Droplet generation in a micro-channel by flowing DI water and mineral oil. a The geometry of the micro-channel and the entrance of the fluids, b a numerical simulation in COMSOL multi-physics environment with Ca = 0.194, Qc/Qd = 8 and μc/μd = 17.6

In Fig. 1b, the dynamics of the droplet generation is shown in COMSOL multi-physics environment. The discrete phase, DI water, is flown (i.e. uniform velocity boundary condition) from the one channel and the continuous phase, mineral oil, is injected from two other channels that are perpendicular to the continuous phase flow. Zero pressure boundary condition (gauge pressure) is assumed at the outlet of the channel. At the first stage, the discrete phase flow is extended in both axial and radial directions such that the tip of the flow has a dome shape. In the second stage, the continuous phase narrows the discrete phase in the radial direction and extends it in the axial direction. This stage continues up to create the throat. In the third stage, the throat is created and becomes narrower up to droplet separation. In fact, the discrete phase flow is narrowed by the continuous phase flow until the droplet is generated after the orifice. The time duration of this process is called separation time and the length between the beginnings of the channel up to droplet separation location is called separation length. Reducing the separation time cause to shorter separation length.

Formation of a droplet in a microchannel can be specified by many numbers such as the inlet volumetric flow rates (Qd and Qc), the interfacial tension (σ), fluid densities (ρc and ρd) and fluid viscosities (μd and μc). In the aforementioned variables, subscripts ‘d’ and ‘c’ indicate the dispersed and the continuous phase.

The dynamics of the droplet size in a microchannel can be specified by many dimensionless numbers. The Capillary number (Ca) of the continuous phase is one of the key dimensionless numbers, which is the ratio of the viscous force and surface tension force. The Capillary number is defined as follows:

$$ Ca=\frac{\mu_c{u}_c}{\sigma } $$
(1)

Where, uc is the average inlet velocity, μc is the dynamic viscosity of the continuous phase, and σ is the interfacial tension. The Reynolds number (Re) describes the ratio of inertia to viscous stresses.

$$ \mathit{\operatorname{Re}}=\frac{\rho_c{u}_c{w}_c}{\mu_c} $$
(2)

Where wc is the width of the microchannel at the continuous phase.

The ratio of flow rates and the viscosity ratio of the two immiscible fluids are other important dimensionless variables, defined as follows:

$$ \alpha =\frac{Q_c}{Q_d} $$
(3)
$$ {\mu}_r=\frac{\mu_c}{\mu_d} $$
(4)

Since the difference in the density of the two liquids is small in typical microfluidic systems, the Bond number is also small.

The ranges of the parameters considered in this research are shown in Table 1. Different values for each parameter are considered to generate the input-output dataset by using the verified numerical model and experimental tests.

Table 1 Rang of varying parameters

2.1 Experimental setup

The DI-water and the mineral oil were chosen as dispersed and continuous phase, respectively. The characteristics of the two fluids are given in the Table 2. The flow rates of the fluids are controlled by two syringe pumps. For generating the flow rates a LAMBDA-VIT-FIT-HP syringe-pump was used for oil injection and a Zistrad ISP94–1 pump for DI-water injection. The PDMS micro-channel is fabricated by soft lithography (in visualization and tracking Lab.) and is bonded on a glass. For droplet size detection, a high speed digital microscope was used.

Table 2 The characteristics of the two fluids

For droplet size detection an image processing algorithm is used. In this algorithm, the captured image is cut in the width of the channel. Then, the image becomes binary to recognize the boundary of the droplet, and then the droplet is detected. This process is shown in Fig. 2.

Fig. 2
figure 2

The four steps of image processing: 1 Capturing the picture, 2 Cropping 3 Binarization, and 4 Circle recognition

The images are captured by the Meros high speed digital microscope with the framerate of 150 frames per second and the high resolution of 1280 * 1024. A schematic of the experimental setup is represented in Fig. 3.

Fig. 3
figure 3

The experimental setup and its schematic diagram that consist of two syringe pumps and a digital microscope for size detection and a PDMS microchannel

2.2 Numerical simulation

Modeling two phase flows is usually done by using the Volume of Fluid (VOF) method and the Level-Set method (LS). The volume fraction equation is adopted and the geometric construction is considered by VOF method. The VOF method completely conserves the mass but since the interface of fluids is not calculated precisely, it produces error in the calculation of interfacial forces. In a microfluidic device which has a micro scale orifice, if the creation of droplets was modeled by the VOF method, the inaccurately captured interface could lead to large errors. The LS method, however, utilizes a smooth function to capture the interface which calculates surface tension forces and the curvature conveniently. As a result, the LS method is more beneficial in modeling the process in which the droplet is generated inside a microfluidic device. The governing equations of the flow include continuity (Eq. (5)) and the incompressible Navier-Stokes equation (Eq. (6)):

$$ \frac{\partial \rho }{\partial t}+\nabla .\left(\rho \overrightarrow{u}\right)=0 $$
(5)
$$ \frac{\partial \Big(\rho \overrightarrow{u\Big)}}{\partial t}+\nabla .\left(\rho \overrightarrow{u}\overrightarrow{u}\right)=-\nabla P+\nabla .\left[\mu \left(\nabla \overrightarrow{u}+\nabla {\overrightarrow{u}}^T\right)\right]+\overrightarrow{F} $$
(6)

Where, ρ is the fluid density,\( \overrightarrow{u} \) is the velocity field and \( \overrightarrow{F} \) is the volume body force. Since the density difference between the two phases is small and also velocities and masses are small, the gravitational force is neglected; therefore, \( \overrightarrow{F} \) only consists of the interfacial tension force. The LS equation is given in Eq. (7):

$$ \frac{\partial \phi }{\partial t}+\overrightarrow{u}.\nabla \phi =\gamma \nabla .\left(\epsilon \nabla \phi -\phi \left(1-\phi \right)\frac{\nabla \phi }{\left|\nabla \phi \right|}\right) $$
(7)

The viscosity and the thermo-physical properties of each phase were considered in the numerical model. In other words, the viscosity of each phase was calculated by the level set function. The level set function (ϕ) ranges from 0 to 1, and it varies smoothly from 0 to 1 at the interface. ϵ and γ are the parameters of stabilization. ϕ varies smoothly from 0 to 1 and ϵ sets the thickness of the interface. The parameter ϵ must be selected in a way to ensure its order is the same as the interfacial mesh size order. Consequently, the interfacial parameters like the unit normal to the interface \( \hat{n} \) and the curvature κ, can be calculated by using the Eqs. (8) and (9), respectively:

$$ \hat{n}=\frac{\nabla \phi }{\left|\nabla \phi \right|} $$
(8)
$$ {\left.\kappa =-\nabla .n\right|}_{\phi =0.5} $$
(9)

The relation given in Eq. (10) is used to calculate the surface tension force applied on the interface of the two phases.

$$ \overrightarrow{F_{sf}}=\sigma \kappa \delta \hat{n} $$
(10)

In this equation, σ is the interfacial tension coefficient, whose unit is (mN/m). In this study, this variable has a constant value of 1.5 mN/m (based on the measurements of surface tension in the Lab. by Datis Energy device with 0.1% accuracy). Equation (10) is used to calculate the “surface tension force” applied on the interface of the two phases. In other words, the interfacial force which is necessary in Eq. 6 (force term in the momentum equation) was calculated in each iteration from Eq. (10). F (=\( \overrightarrow{{\mathrm{F}}_{\mathrm{sf}}}=\upsigma\ \upkappa \left(\varnothing \right)\ \updelta \left(\varnothing \right)\ \hat{\mathrm{n}} \)) is the interfacial force in the present two phase problem. δ is a Dirac delta function focused on the interface of two phases. δ is a smooth function approximation which can be calculated from Eq. (11).

$$ \delta =6\left|\nabla \phi \right|\left|\phi \left(1-\phi \right)\right| $$
(11)

The Dirac function (δ) is a sharp function and it may lead to a divergence in the numerical solution. Therefore, a “smooth form” of this function was suitably used for numerical solution. In other words, in numerical simulations, the abrupt jump in the fields will cause instabilities in the numerical method. Therefore, a “smeared out” function is used instead. Also, viscosity μ and the density ρ are smoothed by ϕ across the interface as shown in Eqs. (12) and (13), respectively:

$$ \mu ={\mu}_1+\left({\mu}_2-{\mu}_1\right)\phi $$
(12)
$$ \rho ={\rho}_1+\left({\rho}_2-{\rho}_1\right)\phi $$
(13)

The Initial condition is as follows. At t = 0, the intermediate injection channel completely contains the discrete phase fluid (ϕ = 0) and the rest of the computational domain, including the side injection channels, orifice, and the channel downstream of the orifice Contains a continuous phase (ϕ = 1).

The initial interface between two phases at t = 0 is shown with dashed line in the Fig. 1. In addition, the flow is assumed isothermal and incompressible. The gravity force is neglected.

Also, variation of physical properties such as viscosity and surface tension is neglected. It is assumed that the surface tension at the common boundary between the two phases is constant and does not change with time. The wetting of the channel surfaces relative to the fluid depends on the contact angle.

2.2.1 Grid generation and grid independence verification

The first step for solving equations appropriately is gridding the computational domain. In the created domain, orifice areas and the middle area of the channel, where the droplets are created and moving have a higher importance. As a result, the middle area must have a finer grid. In this area, firstly based on Table 3, four triangular grids sized 5, 10, 15, and 20 μm were examined. Finer grid leads to a higher accuracy in the calculation, more computational cost and a slower speed of calculation. As a result, the length of the droplet during time is measured based on these four grids (Fig. 4). The grids become finer until there is an acceptable difference between the results. As it can be seen in Fig. 4, the difference between the time response of droplet length up to separation in grid 1 and 2 is very similar.

Table 3 The number of elements for different grids in the computational model
Fig. 4
figure 4

The droplet length (between the beginnings of the channel up to droplet separation) versus time for different grid sizes based on Table 1, with Ca = 0.194, Qc/Qd = 8 and μc/μd = 17.6

Based on Table 3, grid 1 is about a triangular grid sized 5 μm with 624,488 elements and grid 2 is about a triangular grid sized 10 μm with 167,412 elements. Since there is no difference between the results of the 2 grids, grid 2 is selected to reduce the computational cost.

As a result, based on Figs. 3 and 4, to have an accurate answer in a shorter time, in less important areas the bigger mesh size, 50 μm, was chosen and in more important areas such as orifice areas and middle part of the channel where droplets are made and are moving, the finer mesh size of 10 μm was chosen.

2.2.2 Validation of the numerical results

In this section, to verify the accuracy of the used numerical method, the results were compared to the experimental results (Fig. 5). It is demonstrated that the diameters of the droplets were in good agreement with the experimental test (Max. Error = 5%). The differences between the COMSOL data and the experiments (i.e. exact error) are not the same for different flow rate ratios as depicted in Fig. 5. The differences may be related to the numerical solution and the iterative methods which were used for solving the discretized equations. Please note that the “grid size” of the numerical solution was verified in Fig. 4. Moreover, in the experiments, we try to fabricate a channel by PDMS, nonetheless, there are some small deviations between numerical and experimental setup (i.e. size of channel, shape of the corners,…). However, the maximum differences between the numerical data and the experimental values were less the 5% (at the worst case).

Fig. 5
figure 5

Verification of numerical data using the experimentla data, with Ca = 0.194 and μc/μd = 17.6

In Fig. 5, the verification of numerical data was shown (comparing to the experimental data) by using Ca = 0.194 and μc/μd = 17.6. Please note that the viscosity ratio was fixed in Fig. 5 (i.e. =17.6) because our experimental data was obtained for a specific oil and water (with properties mentioned in Table 2). In this condition, we only changed the “flow rate ratios” and a comparison was made between the numerical and experimental data (see Fig. 5).

2.3 Dataset generation

For the best and more effective dataset which demonstrates the most effective parameters in the droplet size, we used the Taguchi analysis (Roy n.d.). To find the relevance between parameters of a process and its output the design of experiments (DOE) methods is used. Taguchi method is one of the DOE methods for robust design of experiments. To set an experiment, the Orthogonal arrays (OA) are used. By using this statistical method, one can plan and conduct experiments to obtain adequate data which show the dynamics of the process. In the experiments, we have to know which parameters have the most effect on the droplet size. So, varying these parameters can omit the unnecessary examinations. With the three parameters, if we consider 5 levels for each of them at least, we should test 243 (35) experiments. Through the Taguchi method, mixed level design is used. Two levels are considered for one parameter and four levels for others. Totally, thirty-two experiments are needed. Thirty-six datasets from experimental tests and numerical simulations are regarded.

Almost 20% of the datasets are considered as test datasets and others are used for training. For cross validation, these datasets are separated randomly from different levels of each parameter.

3 ANFIS modeling using hybrid learning

ANFIS is a fuzzy based neural network which combines two characteristics of learning and clustering of data simultaneously (Chen et al. 2016). After generating the input-output dataset for analysis in ANFIS, the next step is to create the ANFIS structure (Fig. 6). The ANFIS structure in this study has three inputs, five layers, and one output. The flow ratio, Capillary number and viscosity ratio are the three inputs. The droplet size is the output of the ANFIS model.

Fig. 6
figure 6

The schematic structure of ANFIS. It has three inputs and one output. The dimensionless numbers Capillary, viscosity ratio and flow ratio are the inputs and the diameter of the droplet is the output. It creates a black-box model to predict the diameter of the droplet in a flow focusing channel

ANFIS creates a black-box model from an input-output dataset. There are five layers in ANFIS structure, each layer of which shows a step in the Takagi-Sugeno-Kang (TSK) fuzzy inference steps. In other words, ANFIS is a TSK fuzzy system in the form of ANN.

Hybrid learning method is the combination of back propagation method and least square (LS) method.

3.1 Fuzzification layer

For each input three bell-shaped membership functions are regarded. In the Fuzzification step, each input enters the corresponding membership function and the fuzzy input is generated. The membership functions were generated by considering the range and levels of the dataset corresponding to each parameter. A Gaussian bell-shaped membership function is in the following form:

$$ g\left(x;n,p\right)=\frac{1}{1+{\left(\frac{x-p}{1}\right)}^{2n}} $$
(14)

n and p in Eq. (14) are two parameters should be updated and adapted to predict the best results. The trained membership functions of each input are demonstrated in Fig. 7.

Fig. 7
figure 7

The membership functions for viscosity ratio, Flow rate ratio and Capillary number. For each input three overlapping bell-shaped membership function are regarded. These membership functions capture the nonlinear dynamics of the two phase flow in a micro-channel

3.2 Accounting the firing strength

There are 27 “IF-THEN” rules in the rule base. The rules are as follows

$$ {R}^l: IF\ Ca\ is\ m{f}_{ca}^l\ and\ {\mu}_r\ is\ m{f}_{\mu_r}^l\ and\ \alpha\ is\ m{f}_{\alpha}^l\ THEN\ d={p}_i Ca+{q}_i{\mu}_r+{r}_i\alpha +{v}_i,\kern1.25em l=1\dots 27. $$

Where X = [Ca, μr, α] ∈ 3 is the input and d ∈  is the output of the fuzzy system. \( m{f}_{ca}^l \) is the fuzzy set of Capillary number, \( m{f}_{\mu_r}^l \) is the fuzzy set of viscosity ratio and \( m{f}_{\alpha}^l \) is the fuzzy set of flow ratio. The parameters pi, qi, ri and vi are adjusted and adopted during the learning process.

The “product” is used as the t-norm in the inference engine. The firing strength is generated in each layer as wi, i = 1, 2, 3. The firing strength wi shows the dependency of each input to the i-th rule. For every input three membership functions are regarded (Fig. 7).

3.3 Normalization

Each weight is normalized according to the following equation:

$$ {w}_i^{\ast }=\frac{w_i}{\sum {w}_i},\kern0.5em i=1,2,3 $$
(15)

Where i shows the number of each rule.

3.4 Output of each layer

According to the Takagi-Sugeno-Kang (TSK) model, the antecedent of each layer is a linear equation with the order of one or zero. In this study, the first-order Takagi-Sugeno-Kang (TSK) model is regarded. In other words, the antecedent of each rule is a linear combination of the inputs:

$$ {y}_i={p}_ia+{q}_ib+{r}_ic+{v}_i $$
(16)

Where, yi is the antecedent of each rule, a is the input 1, b is the input 2 and c is the input 3. The parameters pi, qi, ri and vi are adjusted and adopted during the learning process. The final output of each layer is calculated by multiplication of the normalized weight to yi, i.e. \( {y}_i^{\ast }={w}_i^{\ast }{y}_i \).

3.5 Output of the ANFIS

Finally, the summation of the output of each layer is the output of the ANFIS, i.e.:

$$ Y=\sum {y}_i^{\ast }=\sum {w}_i^{\ast }{y}_i $$
(17)

3.6 Learning algorithm

There are different learning algorithms for the ANFIS method, but the most commonly used algorithm is the hybrid learning, combining two methods of the least squares estimate (LSE) and the gradient method for identifying the parameters (Jang 1993). Forward pass and backward pass are two passes in hybrid learning algorithm. In forward pass the node outputs go forward and the consequent parameters (parameters in the consequent of the fuzzy rules) are identified by the LS method. In backward pass the error signals propagate backward and the premise parameters (parameters in the membership functions) are updated by gradient descent.

4 Results and discussion

After creating the ANFIS model, it should be evaluated by the test dataset and train dataset. This evaluation can be achieved by computing the determination coefficient (R2). This value is determined as follows (Lashkaripour et al. 2018):

$$ {SS}_{tot}=\sum \limits_i{\left({y}_i-\overline{y}\right)}^2 $$
(18)
$$ {SS}_{res}=\sum \limits_i{\left({y}_i-{f}_i\right)}^2 $$
(19)
$$ {R}^2=1-\frac{SS_{res}}{SS_{tot}} $$
(20)

Where y is the output column of the dataset that generated with the verified numerical simulation and f are the outputs of ANFIS which are the predicted outputs and \( \overline{y} \) is mean of yi, i = 1…n as follows:

$$ \overline{y}=\frac{1}{n}\sum \limits_i{y}_i $$
(21)

The largest amount of R2 is one. Therefore, the closer R2 gets to one, the more precise prediction we have.

Another criterion used to evaluate the goodness of the results is the root mean square of the errors. The error is as follow:

$$ {e}_i={y}_i-{f}_i $$
(22)

Therefore, the root mean square of errors is as follows:

$$ RMSE=\sqrt{\frac{\sum \limits_i{e}_i^2}{n}} $$
(23)

Four different random sets of test and train data are selected for evaluating the ANFIS model. For each case, the location of the predicted droplet sizes in relation to R2 = 1 is shown in Fig. 8.

Fig. 8
figure 8

The location of the predicted droplet sizes in related to R2 = 1 for four cases, which shows the ability of the ANFIS model in droplet size prediction in a micro-channel

For each case, the values of R2 and RMSE are shown in Table 4. The values of R2 for the train and all data is approximately 0.95. This difference can be because of the nonlinearity of the real droplet generating system. However, this prediction can prove the effect of some parameters which are very difficult to be compared to each other. The ANFIS predictions in the field of droplet generation will create new insights that can be studied to simplify the complexity and nonlinearity of that.

Table 4 The values of R2 and RMSE for the test, train, and total data for the four cases in Fig. 8

The worst result for the test data is in case 1 due to one point. In this case, the number of the train data around this point is less. However, in the application observer for a micro-channel, the value of R2 for all data is important. Moreover, in (Lashkaripour et al. 2018), the value of R2 for all data was presented.

Because of nonlinear dynamics of the two phase flow in a micro-channel, ANFIS structure has better results than the standard linear regression method and ANN. In other words, ANFIS has a better coefficient of determination relative to linear regression method and ANN (Bayat et al. 2019; Guha Roy and Singh 2020; Amanollahi and Ausati 2020; Khazaee Poul et al. 2019). ANFIS prediction has better result in comparison with the linear regression method due to its nonlinear dynamics. Moreover, ANN has accuracy lost in dealing with systems with highly nonlinear dynamics (Lashkaripour et al. 2018).

The Gaussian bell-shaped membership function is used in ANFIS structure. Other types of membership functions such as triangular membership function, trapezoidal membership function can be chosen in ANFIS structure. The results are sensitive to the shape of the membership functions. The Gaussian bell-shaped membership function has better results.

The variation in the shape and the center of the Capillary number’s membership function are more than two other parameters. This shows that the dynamics of the droplet size is more sensitive to Capillary number.

It has to be noted that regarding dimensionless numbers in describing droplet size dynamics in a micro channel not only gives comprehensiveness in analyzing the dynamics of the system, but also decreases the input of ANFIS. Computational cost decreases by reducing the input of ANFIS. It is so beneficial in using ANFIS as an observer.

5 Conclusion

In this paper, we proposed a predictive model which can be utilized to investigate the effect of parameters in generation of droplet in a flow focusing micro-channel which can be very expensive and difficult in fact. Our predictive model can be trusted with a tolerable error. This predictive model is designed as an ANFIS model trained with a set of input and output data that was generated with experimental tests and a simulation method based on the governing equations in microfluidics which is validated with the experimental data. The inputs are flow rate ratio, capillary number and viscosity ratio. Finally, we demonstrated the validity of the predictive model with the coefficient of determination equals 0.92 that can be accepted with respect to the high nonlinearity of the real system. There are two main advantages obtained, first this experiment was performed with just three dimensionless numbers which compared to most other works has used fewer parameters and more importantly, they are dimensionless which has made a more generalized model compared to other models.