Investigation of Calcium and Magnesium Removal by Donnan Dialysis According to the Doehlert Design for Softening Different Water Types

In this study, calcium and magnesium were removed from Tunisian dam, lake, and tap water using Donnan Dialysis (DD) according to the Doehlert design. Three cation-exchange membranes (CMV, CMX, and CMS) were used in a preliminary investigation to establish the upper and lower bounds of each parameter and to more precisely pinpoint the optimal value. The concentration of compensating sodium ions [Na+] in the receiver compartment, the concentration of calcium [Ca2+] and magnesium [Mg2+] in the feed compartment, and the membrane nature were the experimental parameters. The findings indicate that the CMV membrane offers the highest elimination rate of calcium and magnesium. The Full Factorial Design makes it possible to determine how the experimental factors affect the removal of calcium and magnesium by DD. All parameters used had a favorable impact on the response; however, the calcium and magnesium concentration were the most significant ones. The Doehlert design’s Response Surface Methodology (RSM) was used to determine the optimum conditions ([Mg2+] = 90 mg·L−1, [Ca2+] = 88 mg·L−1, [Na+] = 0.68 mol·L−1) allowing a 90.6% hardness removal rate with the CMV membrane. Finally, we used Donnan Dialysis to remove calcium and magnesium from the three different types of natural water: Dam, Lake, and Tap water. The results indicate that, when compared to lake water and tap water, the removal of calcium and magnesium from dam water is the best. This can be linked to the water matrix’s complexity. Therefore, using Donnan Dialysis to decrease natural waters hardness was revealed to be suitable.


Introduction
Historically, Tunisia is considered an arid and semiarid region due to its limited freshwater resources, making brackish, drainage, and surface water essential sources for drinking. There are issues related to the quantity and quality of Tunisia's surface water resources. Due to the semi-arid to the arid climate found in most parts of the country, periodic droughts, and salty rocks found within the country, water quality has naturally deteriorated [1], making these water resources not immediately reusable because of hardness [2]. Calcium and magnesium ions are mainly responsible for water hardness, and to a lesser extent, the presence of iron and manganese. Water hardness is formed when water percolates through deposits of limestone, chalk, or gypsum [3]. Water is usually classified as soft (0-60 mg·L −1 ), moderately hard (60-120 mg·L −1 ), hard (120-180 mg·L −1 ), and very hard (>180 mg·L −1 ) [4]. Water hardness higher than 200 mg·L −1 can be tolerated but when it is higher than 500 mg·L −1 , it is no longer suitable for consumption. Water hardness may have moderate health benefits [5]. Nerbrand et al. [6] evaluated the relation between calcium and magnesium in drinking water and risk factors for cardiovascular disease in individuals living in hard and soft water areas with considerable differences in cardiovascular mortality. Results revealed significant correlations between the amount of calcium and magnesium in water and major cardiovascular risk factors. Hardness also poses critical problems in industrial settings, where water hardness is monitored to avoid costly breakdowns in boilers, cooling towers, and other equipment that handles water [7]. Many techniques have been used for the removal of calcium and magnesium from water, wastewater, and seawater, such as chemical precipitation [8,9], electrochemical precipitation [10,11], adsorption [12,13], electrolysis [14,15], electrodialysis [16,17], reverse osmosis [18], nanofiltration [19,20], ion-exchange [20,21], and Donnan Dialysis [22,23]. Donnan Dialysis (DD) is a membrane process based on the cross-exchange of ions having the same electrical charge sign between two solutions through an ion-exchange membrane. Its simple operation, low installation and operating costs, and low energy consumption make Donnan dialysis (DD) a very attractive process [22,23]. Its main difference from other membrane technologies is the absence of electrical potential or pressure across the membrane, which does not require any extra energy. Calcium and magnesium ions are transported via a chemical potential gradient between the feed compartment and the receiver compartment (NaCl solution) on either side of a cation exchange membrane (CEM). Continuous ion separation is possible; however, the DD process is not applied in the industry mainly because of its slow kinetics. As known, the DD process is used for purification, concentration, and removal of some ions, such as boron, chromium, nitrates, nitrites, calcium, and magnesium, from wastewater and industrial effluents [24][25][26][27][28][29][30][31][32][33].
This paper presents the application of experimental designs, such as Full Factorial Design and Response Surface Methodology (RSM), using Doehlert. A Doehlert model is a powerful tool that allows data to be collected economically and efficiently as well as model its behavior to obtain mathematical functions that describe the experimental region studied, allowing statistical analysis. The Full Factorial Design is a simple systematic design style that allows for the estimation of main effects and interactions, and the main idea of RSM is to use a sequence of designed experiments to obtain an optimal response. Doehlert design was chosen in this study due to its many advantages; it allows the reduction of the number of experiments and offers high levels of each variable, which allows for obtaining maximum information about the process [34]. The Doehlert design can be considered more efficient than the central composite design or the Box-Behnken design since the efficiency of any experimental design is defined as the number of model coefficients divided by the number of experiments [35,36]. In this study, first, calcium and magnesium removal was performed with four parameters: counter-ion concentration in the receiver compartment, calcium and magnesium concentrations in the feed compartment, and the membrane nature. Then, the parameters' effects and their interactions were studied according to a Full Factorial Design. After the determination of the most important parameters, the Response Surface Methodology using the Doehlert design was conducted to determine the optimal conditions of calcium and magnesium removal. Finally, three types of surface water destined for drinking and irrigation from different locations in Tunisia were tested to validate the suitability of Donnan Dialysis for calcium and magnesium removal.

Reagents and Methods
We prepared one-component solutions from MgCl 2 ·6H 2 O or CaCl 2 ·2H 2 O salts (Sigma-Aldrich, St. Louis, MO, USA). These solutions constitute the feed compartment, and their final concentrations of Ca 2+ or Mg 2+ vary from 10 mg·L −1 to 200 mg·L −1 . As a receiver, we used NaCl solution (Sigma-Aldrich) with Na + concentrations varying from 0.1 mol·L −1 to 2.0 mol·L −1 . All the reagents are commercially available as analytical grades and used without further purification.
The concentrations of sodium, calcium, and magnesium ions in the solution were determined by ion chromatography (Metrohm 761 compact IC ion Chromatography Sys-tem; Paris-France) with a conductivity detector. The separation column used was Metrosep C4-150 (Paris-France). The eluent was composed of 2.0 mmol L −1 nitric acid and 0.75 mmol L −1 dipicolinic acid solution, with a flow rate of 0.9 mL.min −1 , and an injection volume of 20 µL. MagIC Net is a control and database software for ion chromatography instruments that we used to perform all the calculations.
Ca 2+ and Mg 2+ can also be determined by other methods, such as EDTA titration, atomic absorption spectrometry (AAS), and inductively coupled plasma optical emission spectrometry (IPC-MS). As known, the method of EDTA titration is used to determine the total hardness and therefore does not allow differentiating Ca 2+ cations from Mg 2+ . Ion chromatography, AAS, and IPC-MS are the best techniques to determine the concentrations of Ca 2+ and Mg 2+ . In our case, ion chromatography is the most suitable method because the concentrations are often quite high, far exceeding the maximum concentrations of the two other techniques, and therefore avoid dilution operations, sources of measurement errors, and time loss. As with all our work in this manuscript, we have repeated the measurements at least three times. To evaluate the deviations on all the measurements (Tables and  curves) we took the extended uncertainty values which are double the calculating standard uncertainty U for N values. Thus, each value is presented in the form of m ± 2 × σ √ N (m is the mean value and σ is the standard deviation).

Membranes
Three current cationic exchange membranes CEM have been used for the Donnan Dialysis process, which are Selemion ® CMV, Neosepta ® CMS, and Neosepta ® CMX (supplied by Astom-Japan). Their properties are obtained according to the French standard NF X 45-200 [37] and they are listed in Table 1. Some other properties are found in the literature, especially the inter-gel fraction (f 2 ) measured from the application of the microheterogeneous model [38]. This structural model is the most applied one to characterize the microstructures of homogeneous and heterogeneous ion-exchange membranes. Let us note already the rather particular properties of the CMS membrane, which has a good exchange capacity, the highest inter-gel fraction, but a low Ca 2+ transport number. This is certainly due to the surface treatment that was applied to it (two thin positively charged electrolyte layers).
The chemical microstructure of these three membranes is the same and can be represented by Figure 1 [45,46]. Here, we have given only the structure of the active polymer. A PVC weave is used to support this polymer and to reinforce the mechanical properties of the membrane [47,48]. Figure 2 illustrates the different synthesis steps of these membranes [49]. Here, the matrix of synthetic ion-exchange membrane is based on (a) styrene that forms (b) polystyrene chains. The resin matrix (c) consists of polystyrene chains crosslinked with divinylbenzene. To this matrix, functional groups are added. Panel (d) shows the membrane structure of a strong cation exchange membrane containing sulfonic acid functional groups. Let us note already the rather particular properties of the CMS membrane, which has a good exchange capacity, the highest inter-gel fraction, but a low Ca 2+ transport number. This is certainly due to the surface treatment that was applied to it (two thin positively charged electrolyte layers).
The chemical microstructure of these three membranes is the same and can be represented by Figure 1 [45,46]. Here, we have given only the structure of the active polymer. A PVC weave is used to support this polymer and to reinforce the mechanical properties of the membrane [47,48]. Figure 2 illustrates the different synthesis steps of these membranes [49]. Here, the matrix of synthetic ion-exchange membrane is based on (a) styrene that forms (b) polystyrene chains. The resin matrix (c) consists of polystyrene chains crosslinked with divinylbenzene. To this matrix, functional groups are added. Panel (d) shows the membrane structure of a strong cation exchange membrane containing sulfonic acid functional groups.

Donnan Dialysis (DD)
Donnan Dialysis (DD) consists of cross-exchange of ions having the same electrical charge between two solutions through an ion-exchange membrane [50]. The main specificity of DD, compared to other membrane technologies, is that DD does not employ an electrical potential or pressure gradient across the membrane.
In our case, DD application in water softening makes use of only a cation-exchange membrane. The transport of Ca 2+ and Mg 2+ is ensured by a chemical potential gradient  Let us note already the rather particular properties of the CMS membrane, which has a good exchange capacity, the highest inter-gel fraction, but a low Ca 2+ transport number. This is certainly due to the surface treatment that was applied to it (two thin positively charged electrolyte layers).
The chemical microstructure of these three membranes is the same and can be represented by Figure 1 [45,46]. Here, we have given only the structure of the active polymer. A PVC weave is used to support this polymer and to reinforce the mechanical properties of the membrane [47,48]. Figure 2 illustrates the different synthesis steps of these membranes [49]. Here, the matrix of synthetic ion-exchange membrane is based on (a) styrene that forms (b) polystyrene chains. The resin matrix (c) consists of polystyrene chains crosslinked with divinylbenzene. To this matrix, functional groups are added. Panel (d) shows the membrane structure of a strong cation exchange membrane containing sulfonic acid functional groups.

Donnan Dialysis (DD)
Donnan Dialysis (DD) consists of cross-exchange of ions having the same electrical charge between two solutions through an ion-exchange membrane [50]. The main specificity of DD, compared to other membrane technologies, is that DD does not employ an electrical potential or pressure gradient across the membrane.
In our case, DD application in water softening makes use of only a cation-exchange membrane. The transport of Ca 2+ and Mg 2+ is ensured by a chemical potential gradient

Donnan Dialysis (DD)
Donnan Dialysis (DD) consists of cross-exchange of ions having the same electrical charge between two solutions through an ion-exchange membrane [50]. The main specificity of DD, compared to other membrane technologies, is that DD does not employ an electrical potential or pressure gradient across the membrane.
In our case, DD application in water softening makes use of only a cation-exchange membrane. The transport of Ca 2+ and Mg 2+ is ensured by a chemical potential gradient between the feed (natural water) and the receiver (NaCl solution) separated by the cation exchange membrane [50]. The choice of NaCl in the receptor was made mainly because it is available, cheap, fairly mobile, and does not affect the pH of the treated solutions. Two Na + ions replace one Ca 2+ ion, and electroneutrality is thus maintained. Hence, Na + Membranes 2023, 13, 203 5 of 18 is commonly referred to as a compensating ion. Figure 3 presents the Donnan Dialysis scheme for the transport of Ca 2+ and Mg 2+ through the CEM. During the dialysis operations, the monitoring of temporal variations of Na + , Ca 2+ and Mg 2+ concentrations as well as the physicochemical characterization of the membrane allowed us to better explain the phenomenon of cation transport from one compartment to another. The samples were analyzed by ion chromatography, and the removal rate of calcium (Y 1 %), magnesium (Y 2 %), and hardness (Y 3 %) were calculated by Equations (1)-(4) as follows: where the subscripts 0 and e refer to the initial and equilibrium states, respectively.
where the subscript f refers to the final hardness.
between the feed (natural water) and the receiver (NaCl solution) separated by the cation exchange membrane [50]. The choice of NaCl in the receptor was made mainly because it is available, cheap, fairly mobile, and does not affect the pH of the treated solutions. Two Na + ions replace one Ca 2+ ion, and electroneutrality is thus maintained. Hence, Na + is commonly referred to as a compensating ion. Figure 3 presents the Donnan Dialysis scheme for the transport of Ca 2+ and Mg 2+ through the CEM. During the dialysis operations, the monitoring of temporal variations of Na + , Ca 2+ and Mg 2+ concentrations as well as the physicochemical characterization of the membrane allowed us to better explain the phenomenon of cation transport from one compartment to another. The samples were analyzed by ion chromatography, and the removal rate of calcium (Y1%), magnesium (Y2%), and hardness (Y3%) were calculated by Equations (1)-(4) as follows: where the subscripts 0 and e refer to the initial and equilibrium states, respectively.
where the subscript f refers to the final hardness.
The %R [M 2+ ] ratios are the specific removal rate (SRR) (%/mg·L −1 ) expressed as the efficiency of calcium or magnesium removal ratio to the concentration of calcium or magnesium.

Optimization Software
The software used in this study is NemrodW ® , which is essential support for the practical implementation of the Experimental Research Methodology (experimental designs). A full factorial design was conducted first to determine the most important and influential parameter, then the response surface methodology design according to the Doehlert matrix was performed to obtain the optimum condition for the removal of hardness. The %R

CEM
ratios are the specific removal rate (SRR) (%/mg·L −1 ) expressed as the efficiency of calcium or magnesium removal ratio to the concentration of calcium or magnesium.

Optimization Software
The software used in this study is NemrodW ® , which is essential support for the practical implementation of the Experimental Research Methodology (experimental designs). A full factorial design was conducted first to determine the most important and influential parameter, then the response surface methodology design according to the Doehlert matrix was performed to obtain the optimum condition for the removal of hardness.

The Preliminary Study
The delineation of the levels of each factor must be carefully considered so that the domain is neither too small nor too large, as the mathematical models may no longer fit. For this reason, a preliminary study is recommended to guide the selection of high and low Membranes 2023, 13, 203 6 of 18 levels of each factor. A preliminary study was conducted as a parameters' pre-optimization step to define the limits of each parameter, and to better target the optimum.

The Compensating Ion Effects
The effect of the compensating ion, here Na + , was examined for the removal of hardness. During the DD operation, the Na + concentration varied from 0.1 mol·L −1 to 2.0 mol·L −1 when the initial concentrations in the feed compartment were equal to 100 mg·L −1 for each Ca 2+ and Mg 2+ cations, and the stirring rate was maintained at 500 rpm. The three membranes CMV, CMX, and CMS have been tested for a period of 3 h each. Figure 4a,b present the variations of Ca 2+ (a) and Mg 2+ (b) removal versus the compensating ion concentration.

The Preliminary Study
The delineation of the levels of each factor must be carefully considered so that domain is neither too small nor too large, as the mathematical models may no longer For this reason, a preliminary study is recommended to guide the selection of high a low levels of each factor. A preliminary study was conducted as a parameters' pre-op mization step to define the limits of each parameter, and to better target the optimum.

The Compensating Ion Effects
The effect of the compensating ion, here Na + , was examined for the removal of ha ness. During the DD operation, the Na + concentration varied from 0.1 mol·L −1 to 2.0 mol when the initial concentrations in the feed compartment were equal to 100 mg·L −1 for ea Ca 2+ and Mg 2+ cations, and the stirring rate was maintained at 500 rpm. The three me branes CMV, CMX, and CMS have been tested for a period of 3 h each. Figure 4a Here the initial concentrations of Ca 2+ and Mg 2+ in the feed compartment are equal to 100 mg·L −1 and the stirring rate is maintained at 500 rpm.
These two figures show that the three membranes have the same shapes of curves for both Ca 2+ and Mg 2+ removal rates vs. Na + concentration characterized by a weak variation for low Na + concentrations until 0.3 mol·L −1 is reached, followed by a rapid variation and finally a stabilization, or even a very slight decrease for Na + concentrations exceeding 1.0 mol·L −1 . Similar results were also reported by Vanoppen et al. [22] when studying water pre-treatment by DD for reducing multivalent cations concentrations (Ca 2+ , Ba 2+ , Fe 2+ /Fe 3+ , and Mg 2+ ) before the RO process, and by Wisniewski et al. [33] who used DD to remove Ca 2+ and Mg 2+ with a 300 mM Na + solution in the receiver compartment.

Effect of Calcium and Magnesium Concentrations in the Feed Compartment
The calcium and magnesium contents in natural waters were at different levels depending on the geographic location. For this reason, the effect of calcium and magnesium concentrations was explored separately in the feed compartment. We have tested a concentration variation from 10 mg·L −1 to 200 mg·L −1 of calcium and magnesium, with a Na + concentration of 0.5 mol·L −1 and a stirring rate of 500 rpm. In addition, the same three membranes have been tested during the DD operations for the same period of 3 h. The variations of Ca 2+ and Mg 2+ removal rates (vertical bars) in the receiver are presented in Figure 5a,b. The curves in these figures represent the variations of the specific removal rate  Here the initial concentrations of Ca 2+ and Mg 2+ in the feed compartment are equal to 100 mg·L −1 and the stirring rate is maintained at 500 rpm.
These two figures show that the three membranes have the same shapes of curves for both Ca 2+ and Mg 2+ removal rates vs. Na + concentration characterized by a weak variation for low Na + concentrations until 0.3 mol·L −1 is reached, followed by a rapid variation and finally a stabilization, or even a very slight decrease for Na + concentrations exceeding 1.0 mol·L −1 . Similar results were also reported by Vanoppen et al. [22] when studying water pre-treatment by DD for reducing multivalent cations concentrations (Ca 2+ , Ba 2+ , Fe 2+ /Fe 3+ , and Mg 2+ ) before the RO process, and by Wisniewski et al. [33] who used DD to remove Ca 2+ and Mg 2+ with a 300 mM Na + solution in the receiver compartment.

Effect of Calcium and Magnesium Concentrations in the Feed Compartment
The calcium and magnesium contents in natural waters were at different levels depending on the geographic location. For this reason, the effect of calcium and magnesium concentrations was explored separately in the feed compartment. We have tested a concentration variation from 10 mg·L −1 to 200 mg·L −1 of calcium and magnesium, with a Na + concentration of 0.5 mol·L −1 and a stirring rate of 500 rpm. In addition, the same three membranes have been tested during the DD operations for the same period of 3 h. The variations of Ca 2+ and Mg 2+ removal rates (vertical bars) in the receiver are presented in Figure 5a Figure 5a shows that calcium flux through any CEM increases with the increase of calcium concentration from 10 mg·L −1 to 200 mol·L −1 . The transport of calcium is very low at 10 mg·L −1 with a removal efficiency of 14.0 ± 0.9% for CMV, 12.0 ± 1.2% for CMX, and 9.0 ± 1.8% for CMS. The [Ca 2+ ] concentration then increases from 10 mg·L −1 to 200 mg·L −1 and contributes to maintaining the concentration gradient of calcium high involving an improvement of the cross-ion transfer between Na + and Ca 2+ . To explain the calcium diffusion through the membrane, the specific removal rate (SRR) %R [Ca 2+ ] ratio for the three membranes is presented as the curves in the same Figure 5a. According to the SRR, it seems that Ca 2+ diffusion through the membrane was performed with the cross-exchange of Na + at low concentrations, but at high concentrations, the membrane loses its performance, and, as a result, leakage without exchange is induced. Thus, it can be concluded that as the calcium concentration increases, the removal of calcium improves but in a less efficient way [29]. Figure 5b shows that magnesium flux through any CEM increases with the increase of magnesium concentration from 10 mg·L −1 to 200 mol·L −1 . The transport of magnesium is very low at 10 mg·L −1 : 13.0 ± 0.3% for CMV, 10.0 ± 0.3% for CMX, and 6.5 ± 0.5% for CMS. The [Mg 2+ ] concentration then increases from 10 mg·L −1 to 200 mg·L −1 and contributes to maintaining the concentration gradient of magnesium high involving an improvement of the cross-ion transfer between Na + and Mg 2+ . To explain the magnesium diffusion through the membrane, the specific removal rate (SRR) %R [Mg 2+ ] ratio for the three membranes is presented as the curves in the same Figure 5b. These curves indicate that Mg 2+ diffusion through the membrane is performed with the cross-exchange of Na + at low concentrations, but at high concentrations, the membrane loses its performance and a leakage without exchange is obtained. Thus, it can be concluded that as the magnesium concentration increases, the removal of magnesium improves but in a less efficient way [29].

Membrane Selection
With regards to the selection of the best CEM among the three tested membranes (CMV, CMX, and CMS), we have carried out DD operations with a Na + concentration of 0.5 mol·L −1 and a Ca 2+ and Mg 2+ mixture with an initial concentration of 100 mg·L −1 for each one. Figure 6 shows the obtained results after 3 h of operation.

Membrane Selection
With regards to the selection of the best CEM among the three tested membranes (CMV, CMX, and CMS), we have carried out DD operations with a Na + concentration of 0.5 mol·L −1 and a Ca 2+ and Mg 2+ mixture with an initial concentration of 100 mg·L −1 for each one. Figure 6 shows the obtained results after 3 h of operation. According to Figure 6, the CMV membrane has the best removal rates of calcium (75 ± 0.32 %) and magnesium (68 ± 0.38) simultaneously, compared to the CMX membrane, which has removal rates of almost 10-13% under those of the CMV (65 ± 0.37 % and 55 ± 0.47 % for Ca 2+ and Mg 2+ , respectively), and the CMS membrane, which has almost 30% less in the removal rates of the same two cations. In fact, the CMV membrane presents a higher permeability to monovalent than bivalent cations with a high ion-exchange capacity of 2.5 meq.g −1 , and the highest water content of 39%. These properties facilitate and According to Figure 6, the CMV membrane has the best removal rates of calcium (75 ± 0.32%) and magnesium (68 ± 0.38) simultaneously, compared to the CMX membrane, which has removal rates of almost 10-13% under those of the CMV (65 ± 0.37% and 55 ± 0.47% for Ca 2+ and Mg 2+ , respectively), and the CMS membrane, which has almost 30% less in the removal rates of the same two cations. In fact, the CMV membrane presents a higher permeability to monovalent than bivalent cations with a high ion-exchange capacity of 2.5 meq.g −1 , and the highest water content of 39%. These properties facilitate and accelerate the transport of calcium and magnesium from the feed compartment to the receiver compartment. CMX has a high thickness of 170 µm and a low water content of 25%, therefore, it diplays the lowest rate of calcium and magnesium removal. The CMX membrane shows a lower permselectivity of Na + relative to Ca 2+ and Mg 2+ compared to the CMS membrane. This is certainly because of the surface treatment (see Table 1), which makes it very selective to monovalent cations and much less to divalent cations [51]. Wisniewski et al. [33] confirmed that the CMV membrane is effective compared to the CMX one for the elimination of selected anions and cations from water by means of Donnan Dialysis. Therefore, the CMV membrane has been selected for the next study.

Full Factorial Design
A full factorial design 2 k was performed to evaluate the influence of k operating parameters and their interactions with a reduced number of experiments [52]. According to the preliminary study (Section 3.1), four factors were chosen (the concentrations of the compensating ion, calcium and magnesium ions, and the cation-exchange membrane type); the retained experimental range is presented in Table 2. The experimental response (hardness removal efficiency Y 3 ) associated to a factorial design is represented by a linear polynomial model with interaction (Equation (5)): where Y H is the experimental response, X i is the coded variable, b i is the estimation of the principal effect of factor i for response Y, b ij is the estimation of the interaction effect between factor i, and j for response Y. The full factorial matrix consisting of 16 different experiments is presented in Table 3.  According to the experimental response (Table 3), the coefficients of the polynomial model were calculated allowing to predict the theoretical response through Equation (6) This model presents a coefficient of correlation higher than 0.8 (R 2 = 0.988) implying that there is a good agreement between the theoretical response of the model and the experimental response [29,34]. The effect of factors and their interactions are shown in Figure 7a. To highlight the importance of each factor and its influence on the response compared to other factors, the Pareto analysis was carried out [53]. Results are shown in Figure 7b.  The experimental response (hardness removal efficiency Y3) associated to a factorial design is represented by a linear polynomial model with interaction (Equation (5)): YH = b0 + b1X1 + b2X2 + b3X3 + b4X4 + b12X1X2 + b13X1X3 + b14X1X4 + b23X2X3 + b24X2X4 + b34X3X4 (5) where YH is the experimental response, Xi is the coded variable, bi is the estimation of the principal effect of factor i for response Y, bij is the estimation of the interaction effect between factor i, and j for response Y. The full factorial matrix consisting of 16 different experiments is presented in Table  3.
According to the experimental response (Table 3), the coefficients of the polynomial model were calculated allowing to predict the theoretical response through Equation (6) This model presents a coefficient of correlation higher than 0.8 (R 2 = 0.988) implying that there is a good agreement between the theoretical response of the model and the experimental response [29,34]. The effect of factors and their interactions are shown in Figure 7a. To highlight the importance of each factor and its influence on the response compared to other factors, the Pareto analysis was carried out [53]. Results are shown in Figure  7b. The Pareto analysis shows that Ca 2+ and Mg 2+ are the most influential factors in the response with an estimated effect of 33.9% and 30.8%, respectively. Thus, these two factors contribute to about 64.7% of the response. Furthermore, these two factors are followed by the concentration of counter-ion [Na + ] (14.6%). However, the other interactions have a negligible effect; they represent only 10.6% of the studied response.

Response Surface Methodology According to Doehlert
To optimize the operating conditions, the RSM was adopted as it is more economical and efficient than the traditional "one-at-a-time" method [34,36,53,54]. In this study, Doehlert design, which consists of N experiments with N = k 2 + k + 1, was adopted (k is the parameters number; here k = 3 so N = 13. We have added two other experiments to validate the central point). It is an effective model allowing to determine the optimal conditions considering the interactions between the experimental parameters and to predict the value of the response at any point in the experimental domain by a reduced number of experiments [55,56]. The three studied factors are the initial concentrations of Mg 2+ , Ca 2+ , and Na + . Their experimental range and levels are presented in Table 4. Note that the Full Factorial Design allowed as to identify that the most influential parameter is X2. Thus, it is considered as the factor n • 2 in the Doehlert matrix (Table 4), allowing seven levels of variation and, therefore, a quick convergence to the optimal conditions. It is worth mentioning that the use of other models (Central Composite Design, Box-Behnken Design...) requires more than 32 experiments. Response Y (hardness removal efficiency) is described by a polynomial model (Equation (7)): Y = b 0 +b 1 X 1 +b 2 X 2 +b 3 X 3 +b 11 X 2 1 +b 22 X 2 2 +b 33 X 2 3 +b 12 X 1 X 2 +b 13 X 1 X 3 +b 23 X 2 X 3 (7) where b i is the estimation of the principal effect of factor i; b ii is the estimation of the second-order effects; b ij is the estimation of the interactions between factor i and factor j, and X i is the coded variable. The Doehlert matrix contains 15 experiments including three replicates at the center field [57]. The obtained results are presented in Table 5.
Using the experimental result, Y(%) Exp , the polynomial equation was determined (Equation (8)) allowing the prediction of the theoretical response, Y(%) Cal , for each experiment.
This model presents a regression coefficient R 2 = 0.997 greater than 0.7 and the percentage absolute errors of deviation AED (%) = 2.60%, which is less than 10%. According to these two criteria, the model can be considered valid. In addition, the variance analysis (ANOVA) presented in Table 6 shows a p-value less than 0.05 and an F-value higher than the critical Fischer value F (9,5,0.05) = 4.77. Thus, the model is statistically significant and is therefore suitable to describe hardness removal. According to Equation (6), the most influential factor is calcium concentration [Ca 2+ ] with a positive effect on the response (+37.08), followed by magnesium concentration [Mg 2+ ] (+3.46) and sodium concentration [Na + ] (+1.69), which has a positive but moderate effect on hardness removal. This phenomenon is related to the difference in the size of ions; the hydrated ion radius of Ca 2+ (0.412 nm) is smaller than the radius of the Mg 2+ ion (0.429 nm) [58]. Na + ions have a much smaller size in comparison to those of Ca 2+ and Mg 2+ ions (the radius of the hydrated Na + ion is 0.358 nm [58]). This explains the increase in the mobility of Ca 2+ and Mg 2+ ions and causes an increase in the concentration of ions in the boundary layer of a cation-exchange membrane, which improves the removal of Ca 2+ and Mg 2+ . It may be also due to the affinity of the CMV membrane to Ca 2+ > Mg 2+ > Na + . A similar observation indicated that the affinity order for the CMX membrane was: Ca 2+ > Mg 2+ > Na + [41]. The CMS is a monovalent selective cation-exchange membrane (see Table 1) with a thin positively charged layer [59][60][61] applied to their both sides. These two thin layers repel polyvalent ions much more than monovalent ions. Therefore, even if the base polymer of the CMS membrane attracts more bivalent ions (electrostatic interactions between functional sites and polyvalent cations), the latter only reach the base polymer with difficulty. Thus, few polyvalent cations can cross the CMS membrane. This is confirmed by the low value of the Ca 2+ transport number and by the large value of the inter-gel phase fraction in the presence of Na + (see Table 1). On the other hand, the CMV and CMX membranes contain a low amount of a cross-linked agent and a large concentration of inorganic groups. The CMX membrane has the lowest ion-exchange capacity, and the lowest water amount, but the transport number of ions to Ca 2+ with Mg 2+ was better compared to CMS. The membrane CMV has the relatively high ion-exchange capacity, the highest water amount, and the transport number of ion was upper to 0.92. These parameters significantly accelerate transport from the feed to the receiver compartment [41].
The contour plots, shown in Figure 8 representing iso-response curves at the chosen experimental field (delimited by a circle), are used to explain the effect of factors' interactions on hardness removal by Donnan Dialysis.

Application of Different Water Types
This study aims to validate the suitability of Donnan Dialysis for Ca 2+ and Mg 2+ removal from natural waters. In Tunisia, we sampled three natural sources of water: lake water from Ghird el Golla, dam water from Gaafour (Oued Ettoub), and tap water from Raoued. Table 7 shows different characteristics of the water samples. The variation of water parameters can be related to the prevailing climate conditions. Indeed, salinity and temperature were lower for rainy cold periods of the year. The conductivity of tap water was the most important compared to the lake water and dam water. The increase of water conductivity is synonymous to an increase in water salinity and Total Dissolved Salts (TDS). The maximum tolerated Total Dissolved Salts (TDS) of tap water in many south Mediterranean countries like Tunisia was fixed at 1500 mg·L −1 . TDS in water change with seasons and regions from 400 to 1400 mg·L −1 . As these waters were collected in April 2022, this explains the amount of TDS in the three waters. The salinity and the temperature of three waters are located, respectively, between 0.7 and 0.8 g/L and between 15.9 and 18.2 °C. Ca 2+ is most abundant in dam water, while Mg 2+ is most abundant in lake water, owing to limestone, chalk, and gypsum deposits in the soil. As previously described, this study was performed under optimal conditions, namely 0.68 mol·L −1 Na + concentration in the receiver compartment and CMV membrane. Despite some studies of softening natural water by DD [23,33] being limited to using NaCl (0.2 M), and therefore, may require lengthy manipulations for 5 h 30 min or may require very large amounts (2 M), the advantage of the optimization was to get the optimal concentration of compensating ion.  ]. It shows that the maximum of hardness removal is reached for [Na + ] varying from 0.5 to 1 with [Ca 2+ ] up to 55 mg·L −1 . This is explained by the fact that the concentration gradient of the counter-ions increases, hence the cross-ion transfers between two Na + ions and one Ca 2+ to maintain electroneutrality. As shown in Figure 8b, 2+ ] increase. It is worth noting that the increase of calcium concentration contributes to maintaining the gradient concentration of calcium and magnesium high involving an improvement of cross-ion transfer.
The optimal conditions determined according to the desirability function of the NEM-RODW software are 90 mg·L −1 for the concentration of magnesium, 80 mg·L −1 for the concentration of calcium, and 0.68 mol·L −1 for the concentration of sodium, leading to a hardness removal efficiency of 90.6 ± 5.36%.

Application of Different Water Types
This study aims to validate the suitability of Donnan Dialysis for Ca 2+ and Mg 2+ removal from natural waters. In Tunisia, we sampled three natural sources of water: lake water from Ghird el Golla, dam water from Gaafour (Oued Ettoub), and tap water from Raoued. Table 7 shows different characteristics of the water samples. The variation of water parameters can be related to the prevailing climate conditions. Indeed, salinity and temperature were lower for rainy cold periods of the year. The conductivity of tap water was the most important compared to the lake water and dam water. The increase of water conductivity is synonymous to an increase in water salinity and Total Dissolved Salts (TDS). The maximum tolerated Total Dissolved Salts (TDS) of tap water in many south Mediterranean countries like Tunisia was fixed at 1500 mg·L −1 . TDS in water change with seasons and regions from 400 to 1400 mg·L −1 . As these waters were collected in April 2022, this explains the amount of TDS in the three waters. The salinity and the temperature of three waters are located, respectively, between 0.7 and 0.8 g/L and between 15.9 and 18.2 • C. Ca 2+ is most abundant in dam water, while Mg 2+ is most abundant in lake water, owing to limestone, chalk, and gypsum deposits in the soil. As previously described, this study was performed under optimal conditions, namely 0.68 mol·L −1 Na + concentration in the receiver compartment and CMV membrane. Despite some studies of softening natural water by DD [23,33] being limited to using NaCl (0.2 M), and therefore, may require lengthy manipulations for 5 h 30 min or may require very large amounts (2 M), the advantage of the optimization was to get the optimal concentration of compensating ion. We have added, in the last two lines of Table 7, the removal rates of Ca 2+ and Mg 2+ calculated from Figure 9. From this Figure and Table 7, it appears that dam water has the best removal rate (68% of Ca 2+ and 58% of Mg 2+ ) compared to lake water (65% of Ca 2+ and 55% of Mg 2+ ) and tap water (63% of Ca 2+ and 53% of Mg 2+) . This difference is attributed to the effect of accompanying ions on the transfer of a target ion to a combination of the competition for the functional groups inside the membrane and the dialytic kinetics, which reduces calcium and magnesium removal. Figure 9 summarizes the results of the analyses of four main cations (Na + , K + , Ca 2+ , and Mg 2+ ) in each of the three waters used, before and after treatment with DD. Cation K + has been added to the list of analyzed cations because it is found in a non-negligible way in the treated waters. Moreover, the removal rates of calcium and magnesium were relatively low in comparison to the removal rate from synthetic water. This may be due to the presence of other competitive cations (K + , Fe 2+ . . . ), which may reduce calcium and magnesium transport through the membrane, leading to a decrease in calcium and magnesium removal.
analyses of four main cations (Na + , K + , Ca 2+ , and Mg 2+ ) in each of the three waters used, before and after treatment with DD. Cation K + has been added to the list of analyzed cations because it is found in a non-negligible way in the treated waters. Moreover, the removal rates of calcium and magnesium were relatively low in comparison to the removal rate from synthetic water. This may be due to the presence of other competitive cations (K + , Fe 2+ …), which may reduce calcium and magnesium transport through the membrane, leading to a decrease in calcium and magnesium removal. It is interesting to compare the composition of lake water, dam water, and tap water after Donnan Dialysis with the cation-exchange membrane ( Figure 9). As a result of the cation exchange, the molar share of Ca 2+ ions was reduced from 140 mg·L −1 to 49 mg·L −1 in lake water (after Donnan Dialysis with the CMV membrane), from 200 mg·L −1 to 64 mg·L −1 in dam water, and from 100 mg·L −1 to 37 mg·L −1 in tap water. The molar share of Mg 2+ ions was reduced from 72 mg·L −1 to 32.4 mg·L −1 in lake water (after Donnan Dialysis with the CMV membrane), from 60 mg·L −1 to 25.5 mg·L −1 in dam water, and from 60 mg·L −1 to 28.2 mg·L −1 in tap water. The hardness removal rate obtained in the optimization section seems higher (90.6%) compared to the rate of natural waters (68%). This difference is due to the diversity of the cationic components of the three types of water and to the salinity, which affects the chemical potential of Donnan Dialysis. These results indicate the suitability of Donnan Dialysis as a treatment that reduces hardness in natural water.

Conclusions
This work aims to remove calcium and magnesium from Tunisian dams, lakes, and tap waters by softening water through Donnan Dialysis (DD). First, a preliminary study was conducted using three CEM membranes (CMV, CMX, and CMS) in accordance with several parameters, including the concentration of Na + in the receiver compartment and the concentration of calcium and magnesium concentrations in the feed one. The CMV membrane presents a higher permeability, which facilitates and accelerates calcium and magnesium transport from the feed to the receiver compartment, and hence has the best rate of calcium and magnesium removal. The concentrations of calcium and magnesium in the feed compartment were found to be the most important parameters according to the Full Factorial Design. The optimum conditions were identified using the Response Surface Methodology (RSM) of the Doehlert design. Under optimum conditions, [Mg 2+ ] = 90 mg·L −1 , [Ca 2+ ] = 88 mg·L −1 , and [Na + ] = 0.68 mol·L −1 were determined, allowing 90.6% of calcium and magnesium removal with the CMV membrane. Three different types of natural water were tested to validate the suitability of Donnan Dialysis for the removal of calcium and magnesium from real natural waters. The result indicates that the removal of calcium and magnesium from dam water is higher than that of lake water and tap water at 68% and 58%, respectively. The complexity of the water matrix with high salinity is thought to be responsible for the discrepancy. It can be concluded that the Donnan Dialysis can be competitive to other water softening technologies.